if else if要注意,不要写成 全是if的样子
function Find(target, array)
{
// write code here
let row = array.length-1;
let col = array[0].length-1;
if(array !=null && row+1>0&&col+1>0){
let top = 0;
while(top<=row && col>=0){
if(array[top][col]>target){
col--;
}
else if(array[top][col]<target){
top++;
}
else if(array[top][col] == target) return true;
}
return false;
}
}
module.exports = {
Find : Find
};