class Solution {
public:
int findMin(vector<int>& a) {
int low = 0;
int high = a.size() - 1;
while (low < high)
{
int mid = low + (high - low) / 2;
if (a[mid] < a[high])
high = mid;
else
low = mid + 1;
}
return a[low];
}
};
'코딩테스트 > LeetCode' 카테고리의 다른 글
[LeetCode] 6 - Zigzag Conversion (0) | 2024.04.03 |
---|---|
[LeetCode] Sqrt(x) (0) | 2024.03.25 |
[LeetCode] Majority Element (0) | 2023.12.19 |
[LeetCode] Remove All Adjacent Duplicates in String II (0) | 2023.12.12 |
[LeetCode] Remove All Adjacent Duplicates In String (0) | 2023.12.12 |