61. Rotate List
Medium — Linked List, Two Pointers
k:
Apply
Play
Pause
Step
Reset
Speed:
Slow
Normal
Fast
Very Fast
Press "Play" or "Step" to walk the rotation.
Step
0 / 0
n
--
k mod n
--
Phase
--
Cursor
Tail
New tail
New head
Algorithm Complexity
Brute (rotate one)
O(n · k)
Time / Space: O(n · k) / O(1)
Length + Re-Link
O(n)
Time / Space: O(n) / O(1)