Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Merge In Between Linked Lists
Bookmark
Collect into Array
Direct Pointers
Input
Example 1
Example 2
Custom
list1
=
[1, 2, 3, 4, 5, 6]
,
list2
=
[7, 8, 9]
,
a
=
3
,
b
=
4
list1:
1
2
3
4
5
6
list2:
7
8
9
list1:
1
2
3
4
5
6
list2:
7
8
9
list1:
1
2
3
4
5
6
curr
list2:
7
8
9
list1:
1
2
3
4
5
6
curr
list2:
7
8
9
list1:
1
2
3
4
5
6
curr
list2:
7
8
9
list1:
1
2
3
4
5
6
list2:
7
8
9
curr
list1:
1
2
3
4
5
6
list2:
7
8
9
list1:
1
2
3
4
5
6
list2:
7
8
9
list1:
1
2
3
4
5
6
list2:
7
8
9
list1:
1
2
3
4
5
6
list2:
7
8
9
list1:
1
2
3
7
8
9
6
algo
master
.
io
Step:
Start: collect both lists into arrays, pick the surviving nodes, then relink
0 / 18
Input
Example 1
Example 2
Custom
list1
=
[1, 2, 3, 4, 5, 6]
,
list2
=
[7, 8, 9]
,
a
=
3
,
b
=
4
0 / 18
algo
master
.
io
Step:
Start: collect both lists into arrays, pick the surviving nodes, then relink