Approach Summary
Find length n and tail. Make it circular. New tail is at position n - (k % n) - 1; new head is its next. Break the ring.
How to Recognize This Pattern
- k can exceed list length — k % n is the effective rotation
- Connect tail to head, then cut at the right point
Complexity Analysis
Time Complexity
O(n)
Space Complexity
O(1)
Tags
Linked List Two Pointers