Article Directory
![Insert picture description here](https://img-blog.csdnimg.cn/20200413174113616.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3pob3V0aWFuemkxMg==,size_16,color_FFFFFF,t_70)
- If there are no repeating numbers under normal circumstances, then there are only n numbers from 1 to n,
- When there is a repeated number, 1 ~ n has n + 1 numbers.
- So that we can divide the n numbers from the middle number m into two halves,
- If the number in 1-m exceeds m, then the repeated numbers appear in 1 ~ m,
- Conversely, it appears in m + 1 ~ n.
-
For num, <= the number of elements in the array is count
-
When count> num, then 1-
-
When count <= num, the number of <= num is not yet
- There is duplication in num + 1 to n
- Conversely, there is a duplication from 1 to num-1
- The problem becomes, you need to find a number num that satisfies:
- <= num has more elements than num,
- <= num-1 The number of elements is less than num.