Let's put it all together now.
xxxxxxxxxx
133
'PASSED: Expect `mergeLists(2 -> 6 -> 9, 1 -> 2 -> 7, 2 -> 6 -> 10)` to return 1 -> 2 -> 2 -> 2 -> 6 -> 6 -> 7 -> 9 -> 10'
var assert = require('assert');
function mergeLists(arrOfLists) {
// fill in this method
return [];
}
// Supporting data structures
function Node(val) {
this.val = val;
this.next = null;
}
class LinkedList {
constructor() {
this.head = null;
this.tail = null;
}
prepend(newVal) {
const currentHead = this.head;
const newNode = new Node(newVal);
newNode.next = currentHead;
this.head = newNode;
if (!this.tail) {
OUTPUT
Results will appear here.