You are viewing a single comment's thread. Return to all comments →
Another JS solution
function reverse(llist) { let prevNode = null; let currentNode = llist; while(!(currentNode === null)) { const nextNode = currentNode.next currentNode.next = prevNode; prevNode = currentNode; currentNode = nextNode } return prevNode }
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 →
Another JS solution