private static boolean isValidShuffleRecursiveDynamicProgramming(String str1, String str2, String str3, int i, int j, int k, Set<Triplet> cache) {
        if(cache.contains(new Triplet(i, j, k))) {
            return false;
        }

        if(k == str3.length()) {
            return true;
        }

        char c = str3.charAt(k);

        if(i < str1.length() && str1.charAt(i) == c && isValidShuffleRecursiveDynamicProgramming(str1, str2, str3, i+1, j, k+1, cache)) {
            return true;
        }

        if(j < str1.length() && str2.charAt(j) == c && isValidShuffleRecursiveDynamicProgramming(str1, str2, str3, i, j+1, k+1, cache)) {
            return true;
        }

        cache.add(new Triplet(i,j,k));
        return false;
    }