当前位置:网站首页>Binary rotation array (2)
Binary rotation array (2)
2022-06-30 14:37:00 【Douglas_ LT】
A daily topic ing, Today is a day hard topic 154. Find Minimum in Rotated Sorted Array II
class Solution {
public:
int findMin(vector<int>& nums) {
int l=0,r=nums.size()-1,min=nums[0];
while(l<=r){
int mid=(l+r)/2;
if(nums[mid]<min){
min=nums[mid];
}
if(nums[l]==nums[mid]){
l++;
continue;
}
if(nums[l]<nums[mid]){
if(nums[l]<min){
min=nums[l];
}
l=mid+1;
}
else{
if(nums[mid]<min){
min=nums[mid];
}
r=mid-1;
}
}
return min;
}
};
边栏推荐
- Wuenda 2022 machine learning special course evaluation is coming!
- Basic learning notes of C language
- Upgrade centos7 mysql5.5 to mysql5.7 non RPM in the form of tar package
- Detailed explanation of the first three passes of upload Labs
- Not satisfied with markdown native code block style? Try this beautify code screenshot tool~~
- Race of golang
- Three uses of golang underscores
- notepad正则删除关键词所在行
- go channel && select
- PHP multidimensional array sorting
猜你喜欢

Solve the error in my QT_ thread_ global_ End(): 3 threads didn't exit

Initial attack and defense world Misc

Error on datetime when importing SQL file from MySQL

1 figure to explain the difference and connection between nodejs and JS

【BUUCTF】 EasySql

Att & CK red team evaluation field (I)

Computer screenshot how to cut the mouse in

DefCamp Capture the Flag (D-CTF) 2021-22 web

LIS error: this configuration section cannot be used in this path

val_ Loss decreases first and then increases or does not decrease but only increases
随机推荐
DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703
Cost forecast of PMP (BAC, EAC, etc)
@Component use cases
After the MySQL service on the local computer is started and stopped, some services will automatically stop when they are not used by other services or programs
Lihongyi machine learning 2020 homework summary
Detailed explanation of the first three passes of upload Labs
V3_ Chrome extended Chinese translation document V3 directory
Solve the error in my QT_ thread_ global_ End(): 3 threads didn't exit
PS tip: the video frame to Layer command cannot be completed because dynamiclink is not available
Chapter 13 signal (III) - example demonstration
2021-08-07 native and package types
Component communication mode
ot initialized – call ‘refresh’ before invoking lifecycle methods via the context: Root WebApplicati
1 figure to explain the difference and connection between nodejs and JS
PS cutting height 1px, Y-axis tiling background image problem
Calculates the length of the last word in a string, separated by spaces
[buuctf] [actf2020 freshman competition]exec1
Effect of shadow around the block after mouse over
MFQE 2.0: A New Approach for Multi-FrameQuality Enhancement on Compressed Video
2021-05-12