题解 | #旋转数组的最小数字#
旋转数组的最小数字
https://www.nowcoder.com/practice/9f3231a991af4f55b95579b44b7a01ba
这题比较简单练习下js
forEach可以很容易的得到数组中元素的下标(index)
function search( nums , target ) {
// write code here
let flag=-1;
nums.forEach((item,index)=>{
if(item==target){
flag=index;
}
})
return flag;
}

深信服公司福利 830人发布