For this problem, we need to search if an element is in the matrix. I know there is a good method to find the element in O(m + n) complexity. (search an element from top right element) My code is as followed:

```
public class Solution {
public boolean searchMatrix(int[][] matrix, int target) {
// Note: The Solution object is instantiated only once and is reused by each test case.
for(int i = 0, j = matrix[0].length - 1; i < matrix.length && j >= 0;){
if(matrix[i][j] == target)
return true;
else if(matrix[i][j] < target)
i++;
else
j--;
}
return false;
}
}
```

However, I still think this is not a very regular method to do that? Are there any other more conventional way to solve this problem?