Skip to content

Commit 6e927c7

Browse files
committed
add solution: find-minimum-in-rotated-sorted-array
1 parent cf0eb38 commit 6e927c7

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
'''
2+
# 153. Find Minimum in Rotated Sorted Array
3+
4+
## Time Complexity: O(n)
5+
- min() iterates through all elements to find the smallest one.
6+
7+
## Space Complexity: O(1)
8+
- no extra space is used.
9+
'''
10+
class Solution:
11+
def findMin(self, nums: List[int]) -> int:
12+
if len(nums) == 1:
13+
return nums[0]
14+
15+
return min(nums)

0 commit comments

Comments
 (0)