Skip to content

Commit

Permalink
Update find-the-duplicate-number.py
Browse files Browse the repository at this point in the history
  • Loading branch information
kamyu104 committed Sep 28, 2015
1 parent 3c62fc7 commit 9c53ed2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Python/find-the-duplicate-number.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ def findDuplicate(self, nums):
:rtype: int
"""
# Treat each (key, value) pair of the array as the (pointer, next) node of the linked list,
# thus the duplicated number will be the begin of the cycle in the linked list.:
# thus the duplicated number will be the begin of the cycle in the linked list.
# Besides, there is always a cycle in the linked list which
# starts from the first element of the array.
slow = nums[0]
fast = nums[nums[0]]
while slow != fast:
Expand Down

0 comments on commit 9c53ed2

Please sign in to comment.