<span style="white-space:pre"> </span>public int findMin(int[] num) {
int l = 0, h = num.length-1, m;
while(l < h)
{
m = (l+h)/2;
if(num[l] < num[h])
{
return num[l];
}
else if(num[m] > num[h])
{
l = m+1;
}
else //num[m]<num[h]
{
h = m;
}
}
return num[l];
<span style="white-space:pre"> </span>}
[leetcode] Find Minimum in Rotated Sorted Array
最新推荐文章于 2024-06-07 19:37:47 发布