File tree Expand file tree Collapse file tree 2 files changed +3
-13
lines changed
Expand file tree Collapse file tree 2 files changed +3
-13
lines changed Original file line number Diff line number Diff line change @@ -133,17 +133,7 @@ abbrlink: e2c9cca9
133133### Complexity analysis:
134134hour间复杂度 O(N) :In the second encounter,慢pointer须走step数 a<a+b;First encounter中,慢pointer须走step数 a+b−x<a+b,in x 为双pointer重合点and环入口距离;therefore总体为线性复杂度;
135135Spatial complexity O(1) :双pointer使用常数大小的额外空间。
136- <img src =" ../photos/circle link array 2/Picture1.png " alt =" Picture1.png " width =" 50% " height =" 50% " >
137- <img src =" ../photos/circle link array 2/Picture2.png " alt =" Picture2.png " width =" 50% " height =" 50% " >
138- <img src =" ../photos/circle link array 2/Picture3.png " alt =" Picture3.png " width =" 50% " height =" 50% " >
139- <img src =" ../photos/circle link array 2/Picture4.png " alt =" Picture4.png " width =" 50% " height =" 50% " >
140- <img src =" ../photos/circle link array 2/Picture5.png " alt =" Picture5.png " width =" 50% " height =" 50% " >
141- <img src =" ../photos/circle link array 2/Picture6.png " alt =" Picture6.png " width =" 50% " height =" 50% " >
142- <img src =" ../photos/circle link array 2/Picture7.png " alt =" Picture7.png " width =" 50% " height =" 50% " >
143- <img src =" ../photos/circle link array 2/Picture8.png " alt =" Picture8.png " width =" 50% " height =" 50% " >
144- <img src =" ../photos/circle link array 2/Picture9.png " alt =" Picture9.png " width =" 50% " height =" 50% " >
145- <img src =" ../photos/circle link array 2/Picture10.png " alt =" Picture10.png " width =" 50% " height =" 50% " >
146- <img src =" ../photos/circle link array 2/Picture11.png " alt =" Picture11.png " width =" 50% " height =" 50% " >
136+
147137
148138
149139
@@ -166,7 +156,7 @@ class Solution:
166156 a, b = a.next, b.next
167157 return b
168158```
169- ``` C++
159+ ``` cpp
170160class Solution {
171161public:
172162 ListNode * detectCycle(ListNode * head) {
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ class Solution:
4343 return " "
4444```
4545
46- ``` C++ Hash table
46+ ``` cpp Hash table
4747class Solution {
4848public:
4949 string greatestLetter(string s) {
You can’t perform that action at this time.
0 commit comments