[LeetCode]162.Find Peak Element(二)

2015-07-20 17:21:43 · 作者: · 浏览: 14
ins a peak if(num[mid] < num[mid - 1]){ return helper(num,left,mid - 1); }//if // If num[i-1] < num[i],then num[i+1...n-1] must contains a peak else{ return helper(num,mid + 1,right); }//else } }; int main(){ Solution solution; //vector num = {1,2,3,1}; //vector num = {4,3,3,1}; vector num = {2,3,1,4,2,1}; int result = solution.findPeakElement(num); // 输出 cout< \

?