剑指offer35 JZ11 旋转数组的最小数字
旋转数组的最小数字
https://www.nowcoder.com/practice/9f3231a991af4f55b95579b44b7a01ba?tpId=13&tqId=23269&ru=/exam/oj/ta&qru=/ta/coding-interviews/question-ranking&sourceUrl=%2Fexam%2Foj%2Fta%3Fpage%3D1%26tpId%3D13%26type%3D13
暴力
import java.util.*;
public class Solution {
public int minNumberInRotateArray(int [] array) {
int min=array[0];
for(int i=0;i<array.length;i++){
if(min>array[i]){
min=array[i];
}
}
return min;
}
}
外挂法
没啥用,懒得写了
import java.util.*;
public class Solution {
public int minNumberInRotateArray(int [] array) {
Arrays.sort(array);
return array[0];
}
}
我吐了...........牛客这oj也就图一乐