We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3b3df8c commit 6f2ff93Copy full SHA for 6f2ff93
Linked_List/061.Rotate-List/Readme.md
@@ -3,8 +3,7 @@
3
4
1. 确定链表的总长度Len,注意如果Len==0时的处理(此时可以顺便记录末尾节点end)
5
2. 确定实际需要旋转的次数 k=k%Len
6
-3. 利用快慢指针p和q,找到需要断开的地方,即p和q之间。
7
-4. p之后指向NULL,q作为新的head,原本的end之后指向原本的head。
+3. 令p从头指针前进 Len-k+1 步,就到了断开链表的位置。
+4. 将p->next作为新的head,原本的end之后指向原本的head,再把p的next指向NULL,
8
9
-
10
-[Leetcode Link](https://leetcode.com/problems/rotate-list)
+[Leetcode Link](https://leetcode.com/problems/rotate-list)
0 commit comments