public class Solution {public ListNode rotateRight(ListNode head, int k) {if(head == null|| k == 0) {return head;}int size = 1;ListNode tail = head;while (tail.next != null) {size++;tail = tail.next;}k = k % size;ListNode prev = head;for(int i = 0;i < size - k - 1; i++){prev = prev.next;}tail.next = head;head = prev.next;prev.next = null;return head;}}
