<awangdev>Search a 2D Matrix II_3.java
public int searchMatrix(int[][] matrix, int target) {
        if (matrix == null || matrix.length == 0 || matrix[0].length == 0) {
            return 0;
        }
        int row = matrix.length;
        int col = matrix[0].length;
        int x = row - 1;
        int y = 0;
        int count = 0;
        while (x >= 0 && y < col) {
            if (matrix[x][y] < target) {
                y++;
            } else if (matrix[x][y] > target) {
                x--;
            } else {
                count++;
                x--;
                y++;
            }
        }
        return count;
    }
public int sample_funcname ( int [ ] [ ] var_0 , int var_1 ) {
  if ( var_0 == null || var_0 . length == 0 || var_0 [ 0 ] . length == 0 ) {
    return 0 ;
  }
  int var_5 = var_0 . length ;
  int var_6 = var_0 [ 0 ] . length ;
  int var_8 = var_5 - 1 ;
  int var_9 = 0 ;
  int var_10 = 0 ;
  while ( var_8 >= 0 && var_9 < var_6 ) {
    if ( var_0 [ var_8 ] [ var_9 ] < var_1 ) {
      var_9 ++ ;
    }
    else if ( var_0 [ var_8 ] [ var_9 ] > var_1 ) {
      var_8 -- ;
    }
    else {
      var_10 ++ ;
      var_8 -- ;
      var_9 ++ ;
    }
  }
  return var_10 ;
}
