206. Reverse Linked List
202407221554
tags: #linked-list
var reverseList = function(head) {
let cur = head;
let newHead = null;
while (cur !== null) {
const then = cur.next;
cur.next = newHead;
newHead = cur;
cur = then;
}
return newHead;
};