Learn
Practice
Newsletter
Resources
F
Toggle theme
0
F
Toggle theme
0
Toggle menu
← Back to All Animations
Intersection of Two Linked Lists
Bookmark
Input
Example 1
Example 2
No intersection
Intersection at head of A
Simple case
listA
=
[4, 1]
,
listB
=
[5, 6, 1]
,
intersection
=
[8, 4, 5]
4
1
5
6
1
8
4
5
headA
headB
algo
master
.
io
Step:
List A: 4→1→8→4→5, List B: 5→6→1→8→4→5
0 / 31
Input
Example 1
Example 2
No intersection
Intersection at head of A
Simple case
listA
=
[4, 1]
,
listB
=
[5, 6, 1]
,
intersection
=
[8, 4, 5]
0 / 31
4
1
5
6
1
8
4
5
headA
headB
algo
master
.
io
Step:
List A: 4→1→8→4→5, List B: 5→6→1→8→4→5