Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Swap Nodes in Pairs
Bookmark
Recursive
Iterative Dummy
Input
Even length
Odd length
Single node
Empty list
Three pairs
Custom
values
=
[1, 2, 3, 4]
1
2
3
4
1
2
3
4
head
1
2
3
4
head
1
2
3
4
first
second
1
2
3
4
first
second
1
2
3
4
first
second
1
2
3
4
first
second
1
2
3
4
first
second
1
2
3
4
1
2
3
4
1
2
3
4
algo
master
.
io
Step:
Start: swap nodes in pairs recursively
0 / 11
Input
Even length
Odd length
Single node
Empty list
Three pairs
Custom
values
=
[1, 2, 3, 4]
0 / 11
algo
master
.
io
Step:
Start: swap nodes in pairs recursively