<gouthampradhan>dynamic_programming_LargestPlusSign_1.java
public int orderOfLargestPlusSign(int N, int[][] mines) {
    int[][] A = new int[N][N]; 
    int[][] B = new int[N][N]; 
    for (int[] row : mines) {
      int r = row[0];
      int c = row[1];
      A[r][c] = 1;
    }
    for (int i = 0; i < A.length; i++) {
      for (int j = 0; j < A[0].length; j++) {
        if (A[i][j] == 0) {
          A[i][j] = 1;
        } else {
          A[i][j] = 0;
        }
        B[i][j] = Integer.MAX_VALUE;
      }
    }
    for (int i = 0; i < A.length; i++) {
      int prev = 0;
      for (int j = 0; j < A[0].length; j++) {
        if (A[i][j] == 0) {
          prev = 0;
          B[i][j] = 0;
        } else {
          prev++;
          B[i][j] = Math.min(B[i][j], prev);
        }
      }
      prev = 0;
      for (int j = N - 1; j >= 0; j--) {
        if (A[i][j] == 0) {
          prev = 0;
          B[i][j] = 0;
        } else {
          prev++;
          B[i][j] = Math.min(B[i][j], prev);
        }
      }
    }
    for (int j = 0; j < B[0].length; j++) {
      int prev = 0;
      for (int i = 0; i < B.length; i++) {
        if (A[i][j] == 0) {
          prev = 0;
          B[i][j] = 0;
        } else {
          prev++;
          B[i][j] = Math.min(B[i][j], prev);
        }
      }
      prev = 0;
      for (int i = N - 1; i >= 0; i--) {
        if (A[i][j] == 0) {
          prev = 0;
          B[i][j] = 0;
        } else {
          prev++;
          B[i][j] = Math.min(B[i][j], prev);
        }
      }
    }
    int result = 0;
    for (int i = 0; i < B.length; i++) {
      for (int j = 0; j < B[0].length; j++) {
        result = Math.max(result, B[i][j]);
      }
    }
    return result;
  }
public int sample_funcname ( int var_0 , int [ ] [ ] var_1 ) {
  int [ ] [ ] var_2 = new int [ var_0 ] [ var_0 ] ;
  int [ ] [ ] var_3 = new int [ var_0 ] [ var_0 ] ;
  for ( int [ ] var_4 : var_1 ) {
    int var_6 = var_4 [ 0 ] ;
    int var_8 = var_4 [ 1 ] ;
    var_2 [ var_6 ] [ var_8 ] = 1 ;
  }
  for ( int var_9 = 0 ;
  var_9 < var_2 . length ;
  var_9 ++ ) {
    for ( int var_11 = 0 ;
    var_11 < var_2 [ 0 ] . length ;
    var_11 ++ ) {
      if ( var_2 [ var_9 ] [ var_11 ] == 0 ) {
        var_2 [ var_9 ] [ var_11 ] = 1 ;
      }
      else {
        var_2 [ var_9 ] [ var_11 ] = 0 ;
      }
      var_3 [ var_9 ] [ var_11 ] = Integer . MAX_VALUE ;
    }
  }
  for ( int var_9 = 0 ;
  var_9 < var_2 . length ;
  var_9 ++ ) {
    int var_14 = 0 ;
    for ( int var_11 = 0 ;
    var_11 < var_2 [ 0 ] . length ;
    var_11 ++ ) {
      if ( var_2 [ var_9 ] [ var_11 ] == 0 ) {
        var_14 = 0 ;
        var_3 [ var_9 ] [ var_11 ] = 0 ;
      }
      else {
        var_14 ++ ;
        var_3 [ var_9 ] [ var_11 ] = Math . min ( var_3 [ var_9 ] [ var_11 ] , var_14 ) ;
      }
    }
    var_14 = 0 ;
    for ( int var_11 = var_0 - 1 ;
    var_11 >= 0 ;
    var_11 -- ) {
      if ( var_2 [ var_9 ] [ var_11 ] == 0 ) {
        var_14 = 0 ;
        var_3 [ var_9 ] [ var_11 ] = 0 ;
      }
      else {
        var_14 ++ ;
        var_3 [ var_9 ] [ var_11 ] = Math . min ( var_3 [ var_9 ] [ var_11 ] , var_14 ) ;
      }
    }
  }
  for ( int var_11 = 0 ;
  var_11 < var_3 [ 0 ] . length ;
  var_11 ++ ) {
    int var_14 = 0 ;
    for ( int var_9 = 0 ;
    var_9 < var_3 . length ;
    var_9 ++ ) {
      if ( var_2 [ var_9 ] [ var_11 ] == 0 ) {
        var_14 = 0 ;
        var_3 [ var_9 ] [ var_11 ] = 0 ;
      }
      else {
        var_14 ++ ;
        var_3 [ var_9 ] [ var_11 ] = Math . min ( var_3 [ var_9 ] [ var_11 ] , var_14 ) ;
      }
    }
    var_14 = 0 ;
    for ( int var_9 = var_0 - 1 ;
    var_9 >= 0 ;
    var_9 -- ) {
      if ( var_2 [ var_9 ] [ var_11 ] == 0 ) {
        var_14 = 0 ;
        var_3 [ var_9 ] [ var_11 ] = 0 ;
      }
      else {
        var_14 ++ ;
        var_3 [ var_9 ] [ var_11 ] = Math . min ( var_3 [ var_9 ] [ var_11 ] , var_14 ) ;
      }
    }
  }
  int var_17 = 0 ;
  for ( int var_9 = 0 ;
  var_9 < var_3 . length ;
  var_9 ++ ) {
    for ( int var_11 = 0 ;
    var_11 < var_3 [ 0 ] . length ;
    var_11 ++ ) {
      var_17 = Math . max ( var_17 , var_3 [ var_9 ] [ var_11 ] ) ;
    }
  }
  return var_17 ;
}
