@@ -0,0 +1,707 @@
+// Solution runs in O(n) time and O(1) space.%0A// Find length and the last node, make list circular and search for len-k node.%0A// Then unlink nodes and reassign the head.%0A%0A/**%0A * Definition for singly-linked list.%0A * public class ListNode %7B%0A *     int val;%0A *     ListNode next;%0A *     ListNode(int x) %7B val = x; %7D%0A * %7D%0A */%0Aclass Solution %7B%0A  public ListNode rotateRight(ListNode head, int k) %7B%0A    if (head == null) return head;%0A%0A    ListNode tmp = head;%0A    int len = 1;%0A    while (tmp.next != null) %7B%0A      tmp = tmp.next;%0A      len++;%0A    %7D%0A    tmp.next = head;%0A    k %25= len;%0A    while (len %3E k) %7B%0A      tmp = tmp.next;%0A      len--;%0A    %7D%0A    head = tmp.next;%0A    tmp.next = null;%0A    return head;%0A  %7D%0A%7D%0A

add solution