AlgoDaily Solution
1Locked, only available for premium members.
Community Solutions
Community solutions are only available for premium users.
Access all course materials today
The rest of this tutorial's contents are only available for premium members. Please explore your options at the link below.
xxxxxxxxxx
98
function getIntersection(list1, list2) {
// fill in implementation for method
return;
}
// Supporting data structures
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) {
this.tail = newNode;
}
}
append(newVal) {
const newNode = new Node(newVal);
if (!this.head) {
OUTPUT
Results will appear here.