问题描述
Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number, find the duplicate one.
要求
- 不能修改数组(数组只读)
- 空间复杂度\(\Theta(1)\)
- 时间复杂度小于\(\Theta(n^2)\)