Skip to content

Commit caa6e7c

Browse files
author
sejineer
committed
find-minimum-in-rotated-sorted-array solution
1 parent 4f53d3a commit caa6e7c

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+
시간 복잡도: O(logN)
3+
공간 복잡도: O(1)
4+
"""
5+
class Solution:
6+
def findMin(self, nums: List[int]) -> int:
7+
start, end = 0, len(nums) - 1
8+
9+
while start < end:
10+
mid = (start + end) // 2
11+
if nums[mid] > nums[end]:
12+
start = mid + 1
13+
else:
14+
end = mid
15+
return nums[start]

0 commit comments

Comments
 (0)