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 29ec6d3 commit 0b49d70Copy full SHA for 0b49d70
linked-list-cycle/yhkee0404.go
@@ -8,12 +8,12 @@
8
func hasCycle(head *ListNode) bool {
9
u := head
10
v := head
11
- for u != nil && v != nil {
+ for u != nil && v != nil { // T(n) = O(n), S(n) = O(1)
12
u = u.Next
13
if (u == nil) {
14
break
15
}
16
- u = u.Next
+ u = u.Next // https://hyp.is/gLsBIOHBEe6E_9M9T5MJNw/yhkee0404.github.io/posts/algorithms/leetcode/linked-list-cycle/
17
v = v.Next
18
if u == v {
19
return true
0 commit comments