NVIDIA·Software Engineer·Technical Phone Screen
- Given an integer array of length n where every element is in the range [1, n-1] and at least one duplicate exists, find any duplicate number using O(1) extra space and better than O(n^2) time.
“I went straight for the cyclic sort approach since mutating the array was allowed, which worked fine.”