当前位置:网站首页>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;
}
};
边栏推荐
- Getting started with shell Basics
- 2021-08-05 leetcode notes
- Use PHP to delete the specified text content in the file
- Error $(...) size is not a function
- Cost forecast of PMP (BAC, EAC, etc)
- ctfshow nodejs
- Judgment of deep learning experiment results
- Lihongyi machine learning 2020 homework summary
- Notes on reverse learning in the first week of winter vacation
- Pit used by go language array type
猜你喜欢

Geoffreyhinton: my 50 years of in-depth study and Research on mental skills

2021-07-14 mybaitsplus

val_ Loss decreases first and then increases or does not decrease but only increases

Fastcgi CGI shallow understanding

Component communication mode

Thinkphp5 log file contains trick

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

Wuenda 2022 machine learning special course evaluation is coming!

DefCamp Capture the Flag (D-CTF) 2021-22 web
![[extensive reading of papers] multimodal attribute extraction](/img/ec/546c107ac0d31deded7ca94fdf0e2d.jpg)
[extensive reading of papers] multimodal attribute extraction
随机推荐
PHP 2D array change key name
JS delete the objects in the array and specify to delete the objects
Greedy interval problem (5)
XSS challenge (1-5) more detailed answers
Shangpinhui knowledge points of large e-commerce projects
Knowledge learned from the water resources institute project
Small exercise of process and signal
Race of golang
Initial attack and defense world Misc
1 figure to explain the difference and connection between nodejs and JS
V3 03_ Getting started
2021 geek challenge Web
Laravel8 custom log directory, rename
【BUUCTF】[GXYCTF2019]Ping Ping Ping1
Learn about data kinship JSON format design from sqlflow JSON format
Clear the route cache in Vue
Details of gets, fgetc, fgets, Getc, getchar, putc, fputc, putchar, puts, fputs functions
LeetCode_ Stack_ Medium_ 227. basic calculator II (without brackets)
PS dynamic drawing
[extensive reading of papers] multimodal attribute extraction