public int uniquePaths2(int m, int n) {
        int[][] memo = new int[m + 1][n + 1];
        for(int i = 1; i < m + 1; i++){
            for(int j = 1; j < n + 1; j++){
                if(i == 1)
                    memo[i][j] = 1;
                else if(j == 1)
                    memo[i][j] = 1;
                else{
                    memo[i][j] = memo[i - 1][j] + memo[i][j - 1];
                }
            }
        }
        return memo[m][n];
    }