Skip to content

Commit 994008a

Browse files
authored
Create Find Minimum in Rotated Sorted Array.py
1 parent 6d74834 commit 994008a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
'''
2+
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.
3+
4+
(i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).
5+
6+
Find the minimum element.
7+
8+
You may assume no duplicate exists in the array.
9+
10+
Example 1:
11+
12+
Input: [3,4,5,1,2]
13+
Output: 1
14+
Example 2:
15+
16+
Input: [4,5,6,7,0,1,2]
17+
Output: 0
18+
'''
19+
20+
class Solution(object):
21+
def findMin(self, nums):
22+
"""
23+
:type nums: List[int]
24+
:rtype: int
25+
"""
26+
return min(nums)

0 commit comments

Comments
 (0)