zhedahht / CodingInterviewChinese2

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

面试题第三题代码是不是有问题? #47

Open xuesanshi opened 5 years ago

xuesanshi commented 5 years ago

假如前四个数字数字刚刚好,那是不是要把middle换一下?
if(count > (middle - start + 1)) end = middle; else start = middle + 1; 应该改为 if(count > (middle - start + 1)) end = middle; else start = middle + 1; middle= end ;

xiaoCD commented 4 years ago

为什么要换呢?已经结束本次循环进行下一循环了呀。