Skip to content

Commit

Permalink
add solution: find-minimum-in-rotated-sorted-array
Browse files Browse the repository at this point in the history
  • Loading branch information
dusunax committed Feb 6, 2025
1 parent cf0eb38 commit 6e927c7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions find-minimum-in-rotated-sorted-array/dusunax.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
'''
# 153. Find Minimum in Rotated Sorted Array
## Time Complexity: O(n)
- min() iterates through all elements to find the smallest one.
## Space Complexity: O(1)
- no extra space is used.
'''
class Solution:
def findMin(self, nums: List[int]) -> int:
if len(nums) == 1:
return nums[0]

return min(nums)

0 comments on commit 6e927c7

Please sign in to comment.