0%
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| function printListNodeFromTail(head) { if (!head) return; printListNodeFromTail(head.next); console.log(head.value); return head; }
function printListNodeFromTail2(head) { const listNodeArray = []; while (head) { listNodeArray.unshift(head); head = head.next; }
listNodeArray.forEach(item => console.log(item.value)); }
|