当前位置:网站首页>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;
}
};
边栏推荐
- Why is the resolution of the image generated by PHP GD library 96? How to change it to 72
- Mutex lock, read / write lock, spin lock, pessimistic lock, and optimistic lock
- Details of gets, fgetc, fgets, Getc, getchar, putc, fputc, putchar, puts, fputs functions
- remote: Support for password authentication was removed on August 13, 2021. Please use a personal ac
- PS cutting height 1px, Y-axis tiling background image problem
- The JSON data returned from the control layer to JS has a "\" translator. How to remove it
- Go language for loop multivariable use
- 【BUUCTF】 Have Fun
- XSS challenge (1-5) more detailed answers
- August 24, 2021 deque queue and stack
猜你喜欢
[email protected][])"/>NoViableAltException([email protected][])

About the problems encountered when using the timer class to stop with a button (why does the QPushButton (for the first time) need to be clicked twice to respond?)

Thinkphp5 log file contains trick

Error $(...) size is not a function

Detailed explanation of the first three passes of upload Labs

Getting started with shell Basics

go channel && select

PS tip: the video frame to Layer command cannot be completed because dynamiclink is not available

Fastcgi CGI shallow understanding

ThinkPHP show method parameter controllable command execution
随机推荐
Error $(...) size is not a function
How to use Alibaba Vector Icon
[buuctf] [actf2020 freshman competition]exec1
从控制层返回到js的json数据带“\”转译符,怎么去掉
Problem: wechat developer tool visitor mode cannot use this function
How to realize selective screen recording for EV screen recording
JS array sorting method summary
Upgrade centos7 mysql5.5 to mysql5.7 non RPM in the form of tar package
數據恢複軟件EasyRecovery15下載
LIS error: this configuration section cannot be used in this path
Four isolation levels of MySQL
Implementation of forwarding server using IO multiplexing
[buuctf] [geek challenge 2019] secret file
The difference between settimeout() and setinterval()
Initial attack and defense world Misc
PS tip: the video frame to Layer command cannot be completed because dynamiclink is not available
Use of laravel repository mode
[extensive reading of papers] multi modal sarcasm detection and human classification in code mixed conversations
Vue returns to the previous page without refreshing the page / Vue caches the page
2021-08-07 native and package types