Search a 2D Matrix
Problem statement
Write an efficient algorithm that searches for a value target in an m x n integer matrix matrix. This matrix has the following properties:
- Integers in each row are sorted from left to right.
- The first integer of each row is greater than the last integer of the previous row.
Example 1:

Input: matrix = [[1,3,5,7],[10,11,16,20],[23,30,34,60]], target = 3Output: true
Example 2:

Input: matrix = [[1,3,5,7],[10,11,16,20],[23,30,34,60]], target = 13Output: false
Constraints:
m == matrix.lengthn == matrix[i].length1 <= m, n <= 100-104 <= matrix[i][j], target <= 104
My solution
/**
* @param {number[][]} matrix
* @param {number} target
* @return {boolean}
*/
var searchMatrix = function(matrix, target) {
if (matrix.length === 0) {
return false;
}
const row = matrix.length;
const column = matrix[0].length;
let i = 0;
let j = column - 1;
while (i >= 0 && i < row && j >= 0 && j < column) {
// console.log(i, j)
let value = matrix[i][j]
if (value === target) {
return true
} else if (value < target) {
i++
} else {
j--
}
}
return false;
};