public static int findLCSDP(String S, String T){
        int m = S.length();
        int n = T.length();
        int[][] memo = new int[m + 1][n + 1];

        for(int i = 0; i < m + 1; i++){
            for(int j = 0; j < n + 1; j++){
                if(i == 0 || j == 0){
                    memo[i][j] = 0;
                }else{
                    if(S.charAt(i - 1) == T.charAt(j - 1)){
                        memo[i][j] = memo[i - 1][j - 1] + 1;
                    }else{
                        memo[i][j] = Math.max(memo[i - 1][j], memo[i][j - 1]);
                    }
                }
            }
        }
        return memo[m][n];
    }