Algorithm · C3.ai · Medium
You are given an integer array nums of length n + 1, where every element lies in the range 1 to n inclusive. Among these values, there is exactly one value that is repeated. Return that repeated value. Your solution must leave nums unchanged (the array may not be modified) and may use only a constant amount of extra space. Constraints: nums.length == n + 1 1 <= nums[i] <= n Exactly one value in nums is repeated. The array must not be modified. Only constant extra space may…