FrontendX
Rotate Linked List
medium
Description
AI Assistance
Solution
Test Cases
Test Result
Submissions
Canvas
Rotate Linked
List
Rotate linked list to right by k places.
Examples
Example 1
Input:
[1,2,3]
Output:
[1,2,3]
Example 2
Input:
[1,2,3]
Output:
[1,2,3]
Hints
Hint 1
Connect end to head to make a circle.
Hint 2
Find the new tail (n-k-1 nodes from head).
Hint 3
Break after the new head.
Rotate Linked List
Rotate linked list to right by k places.