Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Vote For New Content
Mine was a little different: class Node { constructor(val, next = null) { th...

Clodoaldo Favaro

Aug 4, 2022

Mine was a little different:

class Node { constructor(val, next = null) { this.val = val; this.next = next; }

printList(node) { let str = ''; let pointer = node; while (pointer != null) { str += pointer.val + ' => '; pointer = pointer.next; } console.log(str); } }

function reverseSub(head, p, q) { let beforeSub = null; let afterSub = null;

let pointer = head; let counter = 1; let start = null; let end = null;

//Save the nodes before and after the sublist, and the start and end of the sublist while (counter

0

0

Comments
Comments