Given an integer array nums where no two adjacent elements are equal, find any peak element and return its index. A peak is an element strictly greater than its neighbors. The array boundaries count as negative infinity. Google loves binary search variants. This one tests whether you can apply binary search even when the array isn't sorted.
For instance, in nums = [1,2,3,1], the peak is at index (value ), since and .
The challenge: you must solve this in time. A linear scan works but doesn't meet the requirement. What property of peaks lets you use binary search on an unsorted array?