Snippets Collections
    Node* reverse(Node* head){
        if(!head || !head->next){
            return head;
        }
        Node* newHead = reverse(head->next);
        head->next->next = head;
        head->next = NULL;
        return newHead;
    }
star

Sat May 27 2023 13:10:15 GMT+0000 (Coordinated Universal Time) https://practice.geeksforgeeks.org/problems/modify-linked-list-1-0546/1

#c++ #reverse_linked_list

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension