当前位置:网站首页>Leecode brush questions record sword finger offer 11 Rotate the minimum number of the array
Leecode brush questions record sword finger offer 11 Rotate the minimum number of the array
2022-07-07 00:12:00 【Why is there a bug list】
topic
Move the first elements of an array to the end of the array , We call it rotation of arrays .
Give you a chance to exist repeat An array of element values numbers , It turns out to be an ascending array , And a rotation is carried out according to the above situation . Please return the smallest element of the rotation array . for example , Array [3,4,5,1,2] by [1,2,3,4,5] A rotation of , The minimum value of the array is 1.
Example 1:
Input :[3,4,5,1,2]
Output :1
Example 2:
Input :[2,2,2,0,1]
Output :0
answer
class Solution {
public int minArray(int[] numbers) {
for(int i=0;i<numbers.length;i++)
{
if(i+1==numbers.length) return numbers[0];
if(numbers[i]-numbers[i+1]>0)
return numbers[i+1];
}
return numbers[numbers.length-1];
}
}
边栏推荐
- System activity monitor ISTAT menus 6.61 (1185) Chinese repair
- [vector retrieval research series] product introduction
- App general function test cases
- 互动滑轨屏演示能为企业展厅带来什么
- [2022 the finest in the whole network] how to test the interface test generally? Process and steps of interface test
- TypeScript增量编译
- Sword finger offer 26 Substructure of tree
- How to find out if the U disk file of the computer reinstallation system is hidden
- okcc呼叫中心的订单管理时怎么样的
- SQL的一种写法,匹配就更新,否则就是插入
猜你喜欢

【自动化测试框架】关于unittest你需要知道的事

Close unregistering application XXX with Eureka with status down after Eureka client starts

1000字精选 —— 接口测试基础

Automatic test tool katalon (WEB) test operation instructions

App general function test cases

DAY FIVE

DAY TWO

MATLIB reads data from excel table and draws function image

rancher集成ldap,实现统一账号登录

Competition between public and private chains in data privacy and throughput
随机推荐
Random类的那些事
[2022 the finest in the whole network] how to test the interface test generally? Process and steps of interface test
Every year, 200 billion yuan is invested in the chip field, and "China chip" venture capital is booming
MIT 6.824 - Raft学生指南
【2022全网最细】接口测试一般怎么测?接口测试的流程和步骤
System activity monitor ISTAT menus 6.61 (1185) Chinese repair
openresty ngx_lua子请求
How can computers ensure data security in the quantum era? The United States announced four alternative encryption algorithms
Pytest multi process / multi thread execution test case
DAY SIX
【精品】pinia 基于插件pinia-plugin-persist的 持久化
STM32通过串口进入和唤醒停止模式
2022/2/12 summary
Sword finger offer 26 Substructure of tree
Introduction to GPIO
PostgreSQL highly available repmgr (1 master 2 slave +1witness) + pgpool II realizes master-slave switching + read-write separation
【CVPR 2022】半监督目标检测:Dense Learning based Semi-Supervised Object Detection
微信小程序uploadfile服务器,微信小程序之wx.uploadFile[通俗易懂]
Wind chime card issuing network source code latest version - commercially available
使用yum来安装PostgreSQL13.3数据库