Reverse LL

PHOTO EMBED

Sat Apr 27 2024 11:25:11 GMT+0000 (Coordinated Universal Time)

Saved by @harunmunjal #java

 Node reverseList(Node head)
    {
        if(head == null || head.next == null)
            return head;
        Node p = reverseList(head.next);
        head.next.next = head;
        head.next = null;
        return p;
    }
content_copyCOPY