Skip to content

Commit fa0cc31

Browse files
authored
Update Find Minimum in Rotated Sorted Array - Leetcode 153.py
1 parent ed2bb6f commit fa0cc31

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Find Minimum in Rotated Sorted Array - Leetcode 153/Find Minimum in Rotated Sorted Array - Leetcode 153.py

+13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# Brute Force Solution
2+
class Solution:
3+
def findMin(self, nums: List[int]) -> int:
4+
minn = float('inf')
5+
for num in nums:
6+
if num < minn:
7+
minn = num
8+
return minn
9+
10+
# Time: O(n)
11+
# Space: O(1)
12+
13+
# Optimal Solution
114
class Solution:
215
def findMin(self, nums: List[int]) -> int:
316
n = len(nums)

0 commit comments

Comments
 (0)