当前位置:网站首页>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];
}
}
边栏推荐
- kubernetes部署ldap
- System activity monitor ISTAT menus 6.61 (1185) Chinese repair
- MIT 6.824 - Raft学生指南
- MySQL主从之多源复制(3主1从)搭建及同步测试
- MATLIB从excel表中读取数据并画出函数图像
- Three application characteristics of immersive projection in offline display
- Automatic test tool katalon (WEB) test operation instructions
- Designed for decision tree, the National University of Singapore and Tsinghua University jointly proposed a fast and safe federal learning system
- app通用功能測試用例
- Common modification commands of Oracle for tables
猜你喜欢

How can computers ensure data security in the quantum era? The United States announced four alternative encryption algorithms
![Tourism Management System Based on jsp+servlet+mysql framework [source code + database + report]](/img/41/94488f4c7627a1dfcf80f170101347.png)
Tourism Management System Based on jsp+servlet+mysql framework [source code + database + report]

DAY SIX

Clipboard management tool paste Chinese version

DAY FIVE

What is a responsive object? How to create a responsive object?

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

What is AVL tree?

Wind chime card issuing network source code latest version - commercially available

DAY ONE
随机推荐
SuperSocket 1.6 创建一个简易的报文长度在头部的Socket服务器
《LaTex》LaTex数学公式简介「建议收藏」
华为mate8电池价格_华为mate8换电池后充电巨慢
Google, Baidu and Yahoo are general search engines developed by Chinese companies_ Baidu search engine URL
web渗透测试是什么_渗透实战
微信小程序uploadfile服务器,微信小程序之wx.uploadFile[通俗易懂]
TypeScript中使用类型别名
17、 MySQL - high availability + read / write separation + gtid + semi synchronous master-slave replication cluster
pytest多进程/多线程执行测试用例
Wechat applet UploadFile server, wechat applet wx Uploadfile[easy to understand]
1000字精选 —— 接口测试基础
vector的使用方法_vector指针如何使用
Interface joint debugging test script optimization v4.0
Unity 颜色板|调色板|无级变色功能
【2022全网最细】接口测试一般怎么测?接口测试的流程和步骤
DevOps可以帮助减少技术债务的十种方式
File and image comparison tool kaleidoscope latest download
okcc呼叫中心的订单管理时怎么样的
Devops can help reduce technology debt in ten ways
How to answer the dualistic opposition of Zhihu