Intersection of Two Linked Lists

00:00
MediumLinked ListTwo PointersHashSet
AmazonMicrosoft

Find the node at which two singly linked lists intersect. Return None if no intersection.

Examples

Input → A=4
Output → 1→8→4→5, B=5→6→1→8→4→5 → Node with val 8
Input → A=[2,6,4], B=[1,5]
Output → None
Input → A=[1], B=[1] same node
Output → Node 1