寻找重复数

LeetCode Hot 100 技巧
难度: 中等

题目描述

找到数组中重复的数字,数组长度为 n+1,数字范围为 [1,n]。

解题思路

使用二分查找或快慢指针(Floyd 判圈算法)。时间复杂度为 O(n)。