当前位置:网站首页>剑指 Offer 11. 旋转数组的最小数字
剑指 Offer 11. 旋转数组的最小数字
2022-06-28 17:38:00 【anieoo】
solution:
二分
class Solution {
public:
int minArray(vector<int>& numbers) {
int l = 0,r = numbers.size() - 1;
while(l < r) {
int mid = l + (r - l) / 2;
if(numbers[mid] < numbers[r]) r = mid;
else if(numbers[mid] > numbers[r]) l = mid + 1;
else r--;
}
return numbers[l];
}
};边栏推荐
- [translation] list of Clickhouse 22.4 and 22.5 core features
- Ask flynk SQL cdc Can you synchronize multiple tables and then sink them into one table? Synchronized tables can be accessed through a joi
- 2022a special equipment related management (elevator) special operation certificate examination question bank and online simulation examination
- C 语言进阶
- Industrial digitalization and new generation digitalization system design platform -- Lecture
- Large scale sports events and crime risks
- 2022危险化学品经营单位主要负责人复训题库及在线模拟考试
- Write your own WordPress template
- 强化学习在黄页商家智能聊天助手中的探索实践
- How to upgrade from RHEL 8 to RHEL 9
猜你喜欢

DNSLog注入

2022 practice questions and mock examination of Shandong Province safety officer C certificate examination

win10用cmake3.22与vs2019编译curl库源码并调用

Does face recognition test involve privacy and security issues? A foreign company was urgently stopped

ICML 2022 | transferable imitation learning method based on decoupling gradient optimization

Stackoverflow 2022 developer report: PostgreSQL surpasses MySQL!

2022 operation of simulated examination platform of hoisting machinery command examination question bank

Leetcode 6. Zigzag transformation (awesome, solved)

Kubeadm create kubernetes cluster

2022年化工自动化控制仪表考试模拟100题模拟考试平台操作
随机推荐
Google launches advanced API security to protect APIs from security threats
Matlb| optimal operation and marketization of power system
Flutter tips: mediaquery and build optimization secrets you don't know
How to create a CSR (certificate signing request) file?
The MySQL installed in Alibaba cloud server is version 8. Is it because the MySQL driver version of dataworks does not support it? Now mention
全力冲unreal了
The processor of this virtual machine supports different functions than the processor of the virtual machine that holds the state of the virtual machine
Pure big resentment! Those who were discouraged from taking the postgraduate entrance examination
Small program graduation project based on wechat campus lost and found graduation project opening report function reference
jq插件分析啊啊
使用Pega进行一个简单的RPA程序开发
Idea of capturing mobile terminal variant combination
Apache setting timeout parameter
节点基础~节点层级
如何从RHEL 8升级到RHEL 9
TDengine&nbsp; × Intel edge insight software package accelerates the digital transformation of traditional industries
June 27, 2022 to July 3, 2022 (UE4 video tutorial)
[dark horse morning post] Tencent responded that a large number of users' QQ numbers were stolen; Weiya's husband company was fined 190000 yuan; China Evergrande is applied for liquidation; Guanxiaoto
HTNL简介
Squid proxy server application (I came from afar to make an appointment with you)