Rotate List
Given the head of a linked list, rotate the list to the right by k places.
Rotate List

Given the head of a linked list, rotate the list to the right by k places.

Example 1:
Input: {"head":[1,2,3,4,5],"k":2}
Output: [4,5,1,2,3]
Input
arr ={"head":[1,2,3,4,5],"k":2}

Rotate list by 2 positions to the right

k = 2
Current
New Head
Linked List
head

1

0

2

1

3

2

4

3

5

4

null

Phase: counting

Variables
No variables to display
DepthFunction Call
Stack empty
0/11