You are viewing a single comment's thread. Return to all 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); }
Seems like cookies are disabled on this browser, please enable them to open this website
Reverse a doubly linked list
You are viewing a single comment's thread. Return to all comments →
Here's a four line solution using recursion.