题解 | #旋转数组的最小数字#Java最简单解法

旋转数组的最小数字

http://www.nowcoder.com/practice/9f3231a991af4f55b95579b44b7a01ba

import java.util.ArrayList; public class Solution { public int minNumberInRotateArray(int [] array) { int pre = Integer.MIN_VALUE; for( int temp : array) { if(temp < pre) { return temp; } pre = temp; } return array[0]; } }

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务