Find Duplicate Number — JavaScript medium interview problem
Given an array of integers `nums` containing n + 1 integers where each integer is in the range [1, n] inclusive. There is only one repeated number. Return that number. Constraints (treat as interview rules): you must not modify the array and use only constant extra space. (Hash sets work for practice but prefer Floyd cycle.)
Tags: floyd, binary-search
Practice this Arrays problem free in the JS Interview Playground with automated tests and unlockable solutions.