You are viewing a single comment's thread. Return to all comments →
Simple Java iterative java solution
Node Reverse(Node head) { if(head == null) return null; if(head.next == null) return head; Node temp = null; Node current = head; while(current != null){ temp = current.prev; current.prev = current.next; current.next = temp; current = current.prev; } if(temp!=null) head = temp.prev; return head; }
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 →
Simple Java iterative java solution