comefrom: <awangdev>Longest Increasing Continuous subsequence II_1.java
code: public int dfs(int[][] A, int[][] dp, int[][] flag, int i, int j, int n, int m) {
      	if (flag[i][j] == 1) {
      		return dp[i][j];
      	}
      	int ans = 1;
      	flag[i][j] = -1;
      	int[] dx = {0,  0, 1, -1};
      	int[] dy = {1, -1, 0,  0};
      	for (int k = 0; k < dx.length; k++) {
      		int id = i + dx[k];
      		int jd = j + dy[k];
      		if (id >= 0 && id < n && jd >= 0 && jd < m && A[i][j] < A[id][jd]) {
      			ans = Math.max(ans, dfs(A, dp, flag, id, jd, n, m) + 1);
      		} 
      	}
      	flag[i][j] = 1;
      	dp[i][j] = ans;
      	return dp[i][j];
      }
masked: public int sample_funcname ( int [ ] [ ] A , int [ ] [ ] dp , int [ ] [ ] flag , int i , int j , int n , int m ) {
    if ( flag [ i ] [ j ] == 1 ) {
      return dp [ i ] [ j ] ;
    }
    int ans = 1 ;
    flag [ i ] [ j ] = - 1 ;
    int [ ] dx = {
      0 , 0 , 1 , - 1 };
      int [ ] dy = {
        1 , - 1 , 0 , 0 };
        for ( int k = 0 ;
        k < dx . length ;
        k ++ ) {
          int id = i + dx [ k ] ;
          int jd = j + dy [ k ] ;
          if ( id >= 0 && id < n && jd >= 0 && jd < m && A [ i ] [ j ] < A [ id ] [ jd ] ) {
            ans = Math . max ( ans , dfs ( A , dp , flag , id , jd , n , m ) + 1 ) ;
          }
        }
        flag [ i ] [ j ] = 1 ;
        dp [ i ] [ j ] = ans ;
        return dp [ i ] [ j ] ;
      }
      