Skip to content

Commit

Permalink
update leetcode
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaobinqt committed Sep 5, 2023
1 parent 7c9ea06 commit ba7d321
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion book.leetcode/docs/medium/142.md
Expand Up @@ -43,7 +43,7 @@ func detectCycle(head *ListNode) *ListNode {
// 因为快指针走 2 步,不要判断 next 是否为 nil
for fast != nil && fast.Next != nil {
low = low.Next
fast = fast.Next.Next
fast = fast.Next.Next // 注意这里 fast 是走 2 步
if fast == low {
for low != head {
low = low.Next
Expand Down

0 comments on commit ba7d321

Please sign in to comment.