Solving "Print the Elements of a Linked List" from Hacker Rank ( Easy ) - Problem solving in JS

Solving "Print the Elements of a Linked List" from Hacker Rank ( Easy ) - Problem solving in JS

Rowadz

4 года назад

684 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Rowadz
Rowadz - 01.03.2020 01:13

Recursive solution =

function printLinkedList(head) {
if(!head) return;
console.log(head.data);
printLinkedList(head.next);
}

Ответить
Chetan Nada
Chetan Nada - 29.09.2022 08:35

HI, the solution is not working. Current Question is given in this form.
function printLinkedList(head) {
const re = new SinglyLinkedListNode(head);
console.log(re);
}

Ответить