Advertisement

287. Find the Duplicate Number(Without Extra Space and Modifications to the array)

287. Find the Duplicate Number(Without Extra Space and Modifications to the array) Summary and Takeaway:
1. This problem is similar to detecting a cycle in the linked list.
2. We keep 2 pointers here fast and slow to detect the cycle in the array.
3. Once we detect the cycle we detect the start of the cycle which is the duplicate number.

array)

Post a Comment

0 Comments