How to solve Intersection of Two Linked Lists
Two chains share a common tail. Return the first shared node value, or null. The shared tail is supplied explicitly. Shared nodes are identical objects, not simply equal values. The reference implementation illustrates this approach; check the example and edge cases.
Time and space complexity
O(n+m) traversal time and O(1) space for the pointer-switching approach.
Practise and improve
Choose JavaScript, TypeScript or Python, complete the starter code, then select Run Tests. Request a hint when you need guidance, or choose View solution and confirm if you would like to study the reference implementation.