class Solution {
public boolean searchMatrix(int[][] matrix, int target) {
int x=0,xMax=matrix.length-1,y=matrix[0].length-1,yMin=0;
while (x<=xMax&&y>=yMin){
if (matrix[x][y]==target){
return true;
}
if (matrix[x][y]>target){
y--;
}else{
x++;
}
}
return false;
}
}