You are given a singly linked list and a number k. Move the whole list k steps to the right. One step takes the last node and puts it at the front.
Return the rotated list.
How the judge passes the data
Examples
Example 1:
Input: head = [10,20,30,40], k = 1
Output: [40,10,20,30]
Explanation: The last node, 40, moves to the front.
Example 2:
Input: head = [1,2,3], k = 5
Output: [2,3,1]
Explanation: Rotating 3 times gives back the same list, so 5 rotations act like 2.
Example 3:
Input: head = [6,7], k = 0
Output: [6,7]
Explanation: Zero rotations leave the list as it is.