BM18 二维数组中的查找
function Find(target, array)
{
// write code here
const len = array.length
let n = array[0].length
for(let i = 0; i < len; i++) {
if(target < array[i][0]) break
for(let j = 0; j < n; j++) {
if(target < array[i][j]) {
n = j
break
} else if(target === array[i][j]) {
return true
}
}
}
return false
}
module.exports = {
Find : Find
};
如有问题望指正

京公网安备 11010502036488号