LeetCode - Find Minimum in Rotated Sorted Array II
Posted 朽木の半夏
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LeetCode - Find Minimum in Rotated Sorted Array II相关的知识,希望对你有一定的参考价值。
class Solution {
public:
int fk(int l,int r,vector<int>& nums){
if(nums[l]<nums[r]||l==r)return nums[l];
int m = (l+r)/2;
int k1 = fk(l,m,nums);
int k2 = fk(m+1,r,nums);
return min(k1,k2);
}
int findMin(vector<int>& nums) {
int n = nums.size();
return fk(0,n-1,nums);
}
};
以上是关于LeetCode - Find Minimum in Rotated Sorted Array II的主要内容,如果未能解决你的问题,请参考以下文章
#Leetcode# 153. Find Minimum in Rotated Sorted Array
LeetCode153:Find Minimum in Rotated Sorted Array
#Leetcode# 154. Find Minimum in Rotated Sorted Array II
[LeetCode] 153. Find Minimum in Rotated Sorted Array