Identify Repeated Number
ARRAY
BIT MANIPULATION
Problem
Given an array nums
of size n + 1
containing integers between 1 and n inclusive, identify the single repeated number in the array.
Can you do it without modifying the array and use only constant extra space?
Examples
detectRepeatedNumber([1, 1, 2]) // return 1 detectRepeatedNumber([1, 5, 4, 2, 3, 5]) // return 5
Loading...
Loading...Loading...