zhedahht / CodingInterviewChinese2

《剑指Offer:名企面试官精讲典型编程面试题》第二版源代码
Other
5.32k stars 2.17k forks source link

bugs find #48

Open MingPap opened 5 years ago

MingPap commented 5 years ago

https://github.com/zhedahht/CodingInterviewChinese2/blob/2d6eb6d9127d1ad728ba60bb25bc5a5e91e519ac/03_01_DuplicationInArray/FindDuplication.cpp#L115

只检测出了第一个重复数字,请问怎么判定第二个重复数字4呢?

xiaoCD commented 4 years ago

题目要求是找到即可,如果要继续找,我认为将找到的放到临时数组存放后,将return true;这个结束条件改为continue;继续循环寻找即可。

xiaoCD commented 4 years ago

https://github.com/zhedahht/CodingInterviewChinese2/blob/2d6eb6d9127d1ad728ba60bb25bc5a5e91e519ac/03_01_DuplicationInArray/FindDuplication.cpp#L47