162. 寻找峰值

比较中点和右侧,向较高侧收缩。

难度:中等。题型:Binary Search。

标签:数组、二分、高频面试

二分:if(n[m]>n[m+1]) r=m else l=m+1。 时间复杂度 O(log n),空间复杂度 O(1)。