当前位置:网站首页>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];
}
}
边栏推荐
- Interface joint debugging test script optimization v4.0
- [212] what are three methods for PHP to send post requests
- PostgreSQL使用Pgpool-II实现读写分离+负载均衡
- C语言输入/输出流和文件操作【二】
- 17、 MySQL - high availability + read / write separation + gtid + semi synchronous master-slave replication cluster
- "Latex" Introduction to latex mathematical formula "suggestions collection"
- js导入excel&导出excel
- 在Docker中分分钟拥有Oracle EMCC 13.5环境
- Liuyongxin report | microbiome data analysis and science communication (7:30 p.m.)
- The largest single investment in the history of Dachen was IPO today
猜你喜欢

2022/2/10 summary
![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]

Designed for decision tree, the National University of Singapore and Tsinghua University jointly proposed a fast and safe federal learning system

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

Three application characteristics of immersive projection in offline display

刘永鑫报告|微生物组数据分析与科学传播(晚7点半)

DAY THREE

基于SSM框架实现的房屋租赁管理系统

System activity monitor ISTAT menus 6.61 (1185) Chinese repair

STM32通过串口进入和唤醒停止模式
随机推荐
Local deployment Zeppelin 0.10.1
Tourism Management System Based on jsp+servlet+mysql framework [source code + database + report]
Three sentences to briefly introduce subnet mask
《LaTex》LaTex数学公式简介「建议收藏」
数据运营平台-数据采集[通俗易懂]
MVC and MVVM
37页数字乡村振兴智慧农业整体规划建设方案
What is AVL tree?
Wind chime card issuing network source code latest version - commercially available
What is web penetration testing_ Infiltration practice
[CVPR 2022] target detection sota:dino: Detr with improved detecting anchor boxes for end to end object detection
GPIO简介
什么是响应式对象?响应式对象的创建过程?
DAY FIVE
编译logisim
Yaduo Sangu IPO
DAY ONE
Cas d'essai fonctionnel universel de l'application
Gradle knowledge generalization
Operation test of function test basis