题解 | #数组中重复的数字#
数组中重复的数字
https://www.nowcoder.com/practice/6fe361ede7e54db1b84adc81d09d8524
int duplicate(int* numbers, int numbersLen ) { int a[10001] = {}; for(int i = 0; i < numbersLen; ++i){ a[numbers[i]]++; } for(int i = 0; i< numbersLen; ++i){ if(a[i] >= 2){ return i; } } return -1; }