The naive O(mn) method passed in 1 ms...

```
public class Solution {
public boolean searchMatrix(int[][] matrix, int target) {
int m = matrix.length;
if(m<1) return false;
int n = matrix[0].length;
for(int i=0; i<m; i++) {
for(int j=0; j<n; j++)
if(matrix[i][j]==target) return true;
}
return false;
}
}
```

or even more simplified one following stephen's suggestion (I hate myself forgetting foreach all the time):

```
public class Solution {
public boolean searchMatrix(int[][] matrix, int target) {
for(int[] row : matrix) {
for(int item : row)
if(item==target) return true;
}
return false;
}
}
```