题解 | #旋转数组的最小数字#
旋转数组的最小数字
https://www.nowcoder.com/practice/9f3231a991af4f55b95579b44b7a01ba
/**
*
* @param rotateArray int整型一维数组
* @param rotateArrayLen int rotateArray数组长度
* @return int整型
*/
int minNumberInRotateArray(int* rotateArray, int rotateArrayLen ) {
// write code here
// 就是一个升序数组旋转后的结果
int i=0;
while(i<rotateArrayLen-1&&rotateArray[i]<=rotateArray[i+1]){
i++;
}
if(i == rotateArrayLen-1)
return rotateArray[0];
else
return rotateArray[i+1];
}



