Find Minimum in Rotated Sorted Array
Find the minimum element in a rotated sorted array without duplicates.
Input format
The first line contains N. The second line contains N distinct integers — a sorted array rotated at some pivot.
Output format
Print the minimum element.
Constraints
- Values fit in a 64-bit signed integer
- Trailing whitespace and a trailing newline are ignored by the judge
Read from stdin, write to stdout. Sample cases below show the exact format.
Sample cases
Example 1
Input
5
3 4 5 1 2Expected output
1Example 2
Input
7
4 5 6 7 0 1 2Expected output
0