Skip to content

Commit 67698c1

Browse files
author
Joseph Luce
authored
Update 142_linked_list_cycle_II.md
1 parent 76ae42e commit 67698c1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

leetcode/medium/142_linked_list_cycle_II.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
- N = Nodes in linked list
77

88
By using a fast and slow pointer, slow moves once while fast moves twice, we can figure out if there is a cycle.
9-
However, there is a second property in doing this, at the point where slow and fast meet in the cycle, it is exactly K steps away from the start of the cycle as the head is as fast is to the beginning of the cycle.
9+
However, there is a second property in doing this, at the point where slow and fast meet in the cycle, it is exactly K steps away from the start of the cycle as the head is to the beginning of the cycle.
1010

1111
Reason why this works is that, no matter where the cycle begins or if the number of nodes is even or odd:
1212
1. Slow and fast will always end up moving an even number of times.

0 commit comments

Comments
 (0)