061.Rotate List Posted on 2017-09-24 | In LeetCode Solution 1: accepted 16msA common brute force solution 12345678910111213141516171819202122232425262728public ListNode rotateRight(ListNode head, int k) { if (head == null || k == 0) { return head; } ListNode dummy = head; ListNode tail = null; int length = 0; while (dummy != null) { tail = dummy; dummy = dummy.next; length++; } k = k % length; dummy = head; for (int i = 1; i < length - k; i++) { dummy = dummy.next; } ListNode newHead = head; if (dummy.next != null) { newHead = dummy.next; dummy.next = null; tail.next = head; } return newHead;}