Skip to content

Commit 96483c4

Browse files
authored
Update lintcode-binarysearch-find-peak-element
1 parent 8a3e9ad commit 96483c4

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lintcode-binarysearch-find-peak-element

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ public:
5656
return -1;
5757

5858
int start = 1, end = A.size() - 2;//数据上,LintCode 保证数据第一个数比第二个数小,倒数第一个数比到倒数第二个数小。 因此 start, end 的范围要取 1, A.length - 2
59-
while (l + 1 < r) {
6059
while(start + 1 < end){
6160
int mid = start + (end - start) / 2;
6261

@@ -67,7 +66,7 @@ public:
6766
else // m-1<m, m>m+1 --- peak
6867
return mid;
6968
}
70-
// 在最后的范围内定位。
69+
// 在最后的范围内定位。---这是针对导数第二个和第二个符合条件的情况,按照上面的算法找可能不能找出来
7170
if(A[start] < A[end])
7271
return end;
7372
else

0 commit comments

Comments
 (0)