Find the Mountain Peak

L5 Medium Binary Search
Concept
When an array rises then strictly falls (a mountain), the peak can be located by binary searching the point where the slope flips from up to down.
Given an array arr that strictly increases up to one peak then strictly decreases, return the index of that peak. You may assume the array is a valid mountain (length at least 3, no plateau at the top).
Examples
▸ arr = [0, 1, 0]
→ 1
▸ arr = [0, 2, 1, 0]
→ 1
▸ arr = [0, 1, 2, 3, 2, 1, 0]
→ 3
Progressive Hints
Hint 1 · Nudge
Compare neighbors. If the middle climbs to the right, the peak is ahead; if it drops, the peak is behind.
Hint 2 · Plan
Binary search while comparing each middle element to its right neighbor. If the middle is smaller, the peak lies to the right; otherwise it is at or to the left.
Hint 3 · Approach
lo = 0, hi = last index. While lo < hi: mid = the middle; if arr[mid] < arr[mid + 1] then lo = mid + 1 else hi = mid. Return lo.
Output
// Run your code to see the output here.