题解 | #旋转数组的最小数字#
旋转数组的最小数字
http://www.nowcoder.com/practice/9f3231a991af4f55b95579b44b7a01ba
不知道想是不是有点投机取巧了,就是先给他升序排,直接取第一个数好像就行了
function minNumberInRotateArray(rotateArray)
{
// write code here
rotateArray.sort(function(a,b){
return a-b;
});
return rotateArray[0];
}
module.exports = {
minNumberInRotateArray : minNumberInRotateArray
};