nums
containing n + 1 integers where each integer is in the range [1, n] (inclusive). There is only one repeated number in nums
. Return this number.
nums
in place by marking elements.
nums
and in O(1) space?
findTheDuplicate([1, 3, 4, 2, 2]) → 2
findTheDuplicate([3, 1, 3, 4, 2]) → 3
findTheDuplicate([[1, 1]]) → 1
😳 TIME LEFT: seconds 😳
function findTheDuplicate(nums) {
}
⏰ TOTAL TIME: seconds ⏰