mediumNeetCode 150
Find the Duplicate Number
Find the duplicate number in an array of n+1 integers in range [1,n] Use O(1) space and don't modify the array Example: [1,3,4,2,2] => 2
Find the Duplicate Number rewards precision: narrowing the search space correctly is the whole game. Interviewers love it because it reveals your boundary precision and your edge-case discipline. Interviewers care more about airtight boundaries than speed here.
Arrays & HashingTwo PointersBinary SearchBit Manipulation

Meet Coco
Coco is an AI study partner, not a person. She listens while you explain your code, asks what a line does and never hands you the fix. Typing with Coco is free when you sign in, up to a daily limit. Talking with her out loud comes with the $79 pack. Anyone can open the editor and run their code.
1Find the Duplicate Numbermedium
Based onLeetCode