Back to course home
0% completed
Vote For New Content
Fast/Slow Pointer solution doesn't work
Pete Stenger
Sep 18, 2024
Solution doesn't work on [3, 1, 3], which is one of the test cases.
1
0
Comments
Comments
Felix Pherrya year ago
The test case [3, 1, 3] is not valid because, as the description states, we are given an unsorted array containing n+1 numbers taken from the range 1 to n.
This implies that:
nums.length=n+1
In this case, 3=n+1, which means n=2. Therefore, the maximum number in this ...
C
c.avina05 a year ago
I spent a hot minute before realizing this ha ha.
In the cycle detection solution, you don't have to actually get the cycle length. Just detect if there is a cycle then iterate through the pointers to check if they match
On this page