As reported: Visa Staff Software Engineer (Bangalore), round 1 DSA in Java (2026): find the intersection of two linked lists, then the longest substring without repeating characters.
Given the heads of two singly linked lists headA and headB, return the node at which they intersect (the first node that both lists share), or null if they never meet. The lists must keep their original structure, and there are no cycles.
This is LeetCode 160 — Intersection of Two Linked Lists.
Example
listA = [4,1,8,4,5], listB = [5,6,1,8,4,5], shared tail starts at the node with value 8 -> that node
listA = [1,9,1,2,4], listB = [3,2,4], shared tail starts at the node with value 2 -> that node
listA = [2,6,4], listB = [1,5], no shared node -> null
Constraints: list lengths 1..3·10^4; 1 ≤ Node.val ≤ 10^5. Aim for O(m + n) time and O(1) extra memory.
Code runner format: five lines, as on LeetCode: intersectVal, listA, listB, skipA, skipB — the harness builds the lists so that they share the nodes from index skipA of A / skipB of B on (intersectVal = 0 means no shared node). Implement getIntersectionNode(headA, headB); the harness prints Intersected at '<value>' or No intersection.