Reverse a linked list

PHOTO EMBED

Fri Dec 08 2023 04:20:55 GMT+0000 (Coordinated Universal Time)

Saved by @nistha_jnn #c++

 struct Node* reverseList(struct Node *head)
    {
        if(!head or head->next==NULL)
        {
            return head;
        }
        Node* chotahead=reverseList(head->next);
        head->next->next=head;
        head->next=NULL;
        return chotahead;
    }
content_copyCOPY