int findPeakElement(const vector<int> &num) {
if (num.size() <= 1) return 0;
int mid = 0, l = 0, h = num.size()  1;
while (l < h) {
mid = (l + h) / 2;
if (num[mid] > num[mid + 1])
h = mid;
else if (num[mid] < num[mid + 1])
l = mid + 1;
}
return l;
}
A concise standard binary search solution

@homerhickam , if num[mid]>num[mid+1], then we can know the peak is in the [l, m] span



@dianren ,Given num[1] = num[n] = ∞, if num[mid] > num[mid+1], there is at least one peak in [low, mid], and there may be one peak in [mid+1, high].