Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Vote For New Content
Can't you just return slow value for the similar problem? Since we found that th...

Ada

Apr 10, 2022

Can't you just return slow value for the similar problem? Since we found that there is a cycle when they meet, then surely the duplicate is the value at the slow position, and thus no use for the find_start method? I just returned the slow value without using find_start and it still passes all the cases mentioned above.

1

0

Comments
Comments
W
wuinko 3 years ago

Did the same too, wondering the samething

J
Jeff 3 years ago

This won't work, slow and fast will intersect at some point during the cycle, not necessarily at the start of the cycle. Take this case for example: [2,1,3,4,2]

On this page