We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 24f4a4d commit 3629c89Copy full SHA for 3629c89
find-minimum-in-rotated-sorted-array/WhiteHyun.swift
@@ -0,0 +1,25 @@
1
+//
2
+// 153. Find Minimum in Rotated Sorted Array
3
+// https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/description/
4
+// Dale-Study
5
6
+// Created by WhiteHyun on 2024/06/09.
7
8
+
9
+class Solution {
10
+ func findMin(_ nums: [Int]) -> Int {
11
+ var left = 0
12
+ var right = nums.count - 1
13
+ while left < right {
14
+ let mid = (left + right) >> 1
15
16
+ if nums[mid] > nums[right] {
17
+ left = mid + 1
18
+ } else {
19
+ right = mid
20
+ }
21
22
23
+ return nums[left]
24
25
+}
0 commit comments