You are viewing a single comment's thread. Return to all comments →
Java Solution:
public static SinglyLinkedListNode reverse(SinglyLinkedListNode llist) { SinglyLinkedListNode current = llist; SinglyLinkedListNode pre = null; while(current != null){ SinglyLinkedListNode next = current.next; current.next = pre; pre = current; current = next; } return pre; }
Seems like cookies are disabled on this browser, please enable them to open this website
Reverse a linked list
You are viewing a single comment's thread. Return to all comments →
Java Solution: