Home
Topics
Practice
Roadmap
DSA Tracker
Code Editor
Tech Blogs
More
Sign in
Get started
Loading question...
Feedback
Find the Duplicate Number
Hard
00:00
0 users online
Share
Description
Solution
Submissions
Discussion
Find the duplicate number in array with n+1 integers where each is between 1 and n.
Sample Input:
[1,3,4,2,2]
Sample Output:
2
Hints
Hint 1
Use Floyd's Tortoise and Hare algorithm
Hint 2
Treat array as linked list
Hint 3
Find cycle start point
Code Editor
Reset
Run
Save
Loading...