Concept Flow - Find Peak Element Using Binary Search
Start with low=0, high=n-1
Calculate mid = (low+high)//2
Compare nums[mid
mid
Move high = mid
Repeat until low == high
Return low as peak index
We repeatedly check the middle element and compare it with its right neighbor. If middle is greater, we move left; else, we move right. This narrows down to a peak element.