You are given the head of a singly linked list and an integer k.
Rotate the list to the right by k positions — meaning each node is moved k steps forward, and the nodes that go beyond the end reappear at the start.
Input: head = [1,2,3], k = 1
Output: [3,1,2]
Input: head = [10,20,30,40,50], k = 3
Output: [30,40,50,10,20]
Accepted:
Submission: