You are viewing a single comment's thread. Return to all comments →
C# solution, check in the comments how to change the code in the editor so the solution works.
static SinglyLinkedListNode Solution(SinglyLinkedListNode llist) { var head = new SinglyLinkedListNode(llist.data); while (llist.next != null) { head = new SinglyLinkedListNode(llist.next.data) { next = head }; llist = llist.next; } return head; }
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 →
C# solution, check in the comments how to change the code in the editor so the solution works.