153.Find-Minimum-in-Rotated-Sorted-Array
153. Find Minimum in Rotated Sorted Array
题目地址
https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/
题目描述
Suppose a sorted array in ascending order is rotated at some pivot unknown to you beforehand.
(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).
Find the minimum element.
Example
Example 1:
Input:[4, 5, 6, 7, 0, 1, 2]
Output:0
Explanation:
The minimum value in an array is 0.
Example 2:
Input:[2,1]
Output:1
Explanation:
The minimum value in an array is 1.代码
Approach #1 Binary Search
Approach 2:
Last updated
Was this helpful?