• + 6 comments

    Here's a four line solution using recursion.

        static DoublyLinkedListNode reverse(DoublyLinkedListNode curr) {
        DoublyLinkedListNode temp = curr.next;
        curr.next = curr.prev;
        curr.prev = temp;
        return temp == null ? curr : reverse(temp);
    }
    
    • + 1 comment

      Good Logic! It helped alot! Thank You!

    • + 0 comments

      beautiful!

    • + 0 comments

      Neat solution. Loved it !

    • + 0 comments

      Brilliant

    • + 0 comments

      hey, can you explain 3,4 line. i don't understand, why you use this.

    • + 0 comments

      you solution is the best