var getIntersectionNode = function(headA, headB) {
let nodeA = headA;
let nodeB = headB;
const setA = new Set();
const setB = new Set();
while (nodeA) {
setA.add(nodeA);
nodeA = nodeA.next;
}
while (nodeB) {
setB.add(nodeB);
nodeB = nodeB.next;
}
for (let v of setA) {
if (setB.has(v)) {
return v;
}
}
};