0287-Find-the-Duplicate-Number
Problem Description
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 in nums, return this repeated number.
You must solve the problem without modifying the array nums and using only constant extra space.
Constraints:
- All the integers in
numsappear only once except for precisely one integer which appears two or more times.
Solution
// Time: O()
// Space: O()