const searchMatrix = function (matrix, target) {
if (matrix.length === 0) {
return false;
}
let row = matrix.length-1,
col = 0;
while (row >= 0 && col < matrix[0].length) {
if (matrix[row][col] === target) {
return true;
} else if (matrix[row][col] > target) {
--row;
} else {
++col
}
}
return false;
};