Maximum Number in Mountain Sequence

Given a mountain sequence ofnintegers which increase firstly and then decrease, find the mountain top.

Example

Givennums=[1, 2, 4, 8, 6, 3]return8 Givennums=[10, 9, 8, 7], return10

Note

Find first that nums[mid] > nums[mid + 1]

Code

Last updated