File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,25 +75,25 @@ public ListNode rotateRight2(ListNode head, int n) {
7575 */
7676 public ListNode rotateRight3 (ListNode head , int k ) {
7777 if (head == null )
78- return head ;
78+ return head ;
7979
80- ListNode copyHead = head ;
80+ ListNode copyHead = head ;
8181
82- int len = 1 ;
83- while (copyHead .next != null ) {
84- copyHead = copyHead .next ;
85- len ++;
86- }
82+ int len = 1 ;
83+ while (copyHead .next != null ) {
84+ copyHead = copyHead .next ;
85+ len ++;
86+ }
8787
88- copyHead .next = head ;
88+ copyHead .next = head ;
8989
90- for (int i = len - k % len ; i > 1 ; i --)
91- head = head .next ;
90+ for (int i = len - k % len ; i > 1 ; i --)
91+ head = head .next ;
9292
93- copyHead = head .next ;
94- head .next = null ;
93+ copyHead = head .next ;
94+ head .next = null ;
9595
96- return copyHead ;
96+ return copyHead ;
9797
9898 }
9999
You can’t perform that action at this time.
0 commit comments