0025. Reverse Nodes in k-Group
Reverse every k consecutive nodes in a linked list
Iterative
Recursive
Presets:
[1,2,3,4,5] k=2
[1,2,3,4,5] k=3
[1,2,3,4,5] k=1
[1,2,3,4,5,6] k=2
[1..8] k=3
[1,2,3,4,5] k=5
List:
k:
Build
Step
Play
Pause
Reset
Speed:
5
Step
0
/
0
Ready
Click
Build
to initialize the list, then use
Step
or
Play
to animate the iterative reversal.
Result
—
Group A
Group B
Reversing
Done
Left out
Step
0
/
0
Ready
Click
Build
to initialize the list, then use
Step
or
Play
to animate the recursive reversal.
Result
—
Group A
Group B
Reversing
Done
Left out