Intersection of Two Linked Lists
Given the heads of two singly linked-lists headA and headB, return the node at which the two lists intersect. If the two linked lists have no intersection at all, return null.
Intersection of Two Linked Lists

Given the heads of two singly linked-lists headA and headB, return the node at which the two lists intersect. If the two linked lists have no intersection at all, return null.

Example 1:
Input: {"listA":[4,1,8,4,5],"listB":[5,6,1,8,4,5],"skipA":2,"skipB":3}
Output: 8
Input
arr ={"listA":[4,1,8,4,5],"listB":[5,6,1,8,4,5],"skipA":2,"skipB":3}

Find intersection of two linked lists. A length: 5, B length: 6

Pointer A
Pointer B
Intersection
List A (length: 5)
A

4

A[0]

1

A[1]

8

A[2]

4

A[3]

5

A[4]

null

List B (length: 6)
B

5

B[0]

6

B[1]

1

B[2]

8

B[3]

4

B[4]

5

B[5]

null

Skip A: 2, Skip B: 3 | Intersection at value: 8

Variables
No variables to display
DepthFunction Call
Stack empty
0/16