题解 | #旋转数组的最小数字#
旋转数组的最小数字
http://www.nowcoder.com/practice/9f3231a991af4f55b95579b44b7a01ba
function minNumberInRotateArray(rotateArray)
{
// write code here
var arr = rotateArray.sort(function(a,b){
return a-b
})
return arr[0]
}
module.exports = {
minNumberInRotateArray : minNumberInRotateArray
};
首先按照升序对数组排序,排序后的数组首位就是最小值
传音控股公司福利 325人发布