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 88a189c commit 7177ee6Copy full SHA for 7177ee6
problems/linked-list-cycle/linked_list_cycle.go
@@ -11,8 +11,8 @@ import . "github.com/openset/leetcode/internal/kit"
11
*/
12
func hasCycle(head *ListNode) bool {
13
for p1, p2 := head, head; p1 != nil && p2 != nil; p1 = p1.Next {
14
- if p2.Next != nil {
15
- if p2 = p2.Next.Next; p1 == p2 {
+ if p2 = p2.Next; p2 != nil {
+ if p2 = p2.Next; p1 == p2 {
16
return true
17
}
18
0 commit comments