当前位置:网站首页>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];
}
}
边栏推荐
- GEO数据挖掘(三)使用DAVID数据库进行GO、KEGG富集分析
- Typescript incremental compilation
- App general function test cases
- 在Docker中分分钟拥有Oracle EMCC 13.5环境
- JS import excel & Export Excel
- Newsletter L Huobi ventures is in-depth contact with genesis public chain
- After leaving a foreign company, I know what respect and compliance are
- 2022年PMP项目管理考试敏捷知识点(9)
- The largest single investment in the history of Dachen was IPO today
- Core knowledge of distributed cache
猜你喜欢

2022 latest blind box mall complete open source operation source code / docking visa free payment interface / building tutorial

AVL树到底是什么?

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

陀螺仪的工作原理

Interface joint debugging test script optimization v4.0

App general function test cases

Introduction au GPIO

DevOps可以帮助减少技术债务的十种方式

沉浸式投影在线下展示中的三大应用特点

Who said that new consumer brands collapsed? Someone behind me won
随机推荐
2022 latest blind box mall complete open source operation source code / docking visa free payment interface / building tutorial
使用源码编译来安装PostgreSQL13.3数据库
(leetcode) sum of two numbers
Design of short chain
GPIO簡介
Tourism Management System Based on jsp+servlet+mysql framework [source code + database + report]
[212] what are three methods for PHP to send post requests
Leecode brush questions record interview questions 32 - I. print binary tree from top to bottom
陀螺仪的工作原理
Wind chime card issuing network source code latest version - commercially available
【CVPR 2022】半监督目标检测:Dense Learning based Semi-Supervised Object Detection
Wechat applet UploadFile server, wechat applet wx Uploadfile[easy to understand]
The largest single investment in the history of Dachen was IPO today
Hydrogen future industry accelerates | the registration channel of 2022 hydrogen energy specialty special new entrepreneurship competition is opened!
How can computers ensure data security in the quantum era? The United States announced four alternative encryption algorithms
Server SMP, NUMA, MPP system learning notes.
How rider uses nuget package offline
为什么完全背包要用顺序遍历?简要解释一下
DAY TWO
SuperSocket 1.6 创建一个简易的报文长度在头部的Socket服务器