57. Rotate List
MediumLinked List
Given the head of a linked list, rotate the list to the right by k places. Input is given as an array representation of the linked list and an integer k.
Examples
Input: [1,2,3,4,5] 2
Output: [4,5,1,2,3]
Explanation: Public test case for Rotate List
Constraints
- The number of nodes in the list is in the range [0, 500]
- -100 <= Node.val <= 100
- 0 <= k <= 2 * 10^9
Loading...
Run checks all cases above. Submit evaluates all test cases.