package leetcode;

/**
 * https://leetcode.com/problems/count-sorted-vowel-strings/
 */
public class Problem1641 {
    public int countVowelStrings(int n) {
        // TODO
        return 0;
    }

    public static void main(String[] args) {
        Problem1641 prob = new Problem1641();
        System.out.println(prob.countVowelStrings(1)); // 5
        System.out.println(prob.countVowelStrings(2)); // 15
    }
}

@@ -162,252 +162,659 @@
     
-// TODO%0A        return 0
+int answer = 0;%0A        int nVowels = 5
 ;%0A    
-%7D%0A%0A
     
-public static void main(String%5B%5D args) %7B%0A        Problem1641 prob = new Problem1641();%0A        System.out.println(prob.countVowelStrings(1)); // 5%0A        System.out.println(prob.countVowelStrings(2)); // 15
+Integer%5B%5D%5B%5D memo = new Integer%5Bn%5D%5BnVowels%5D;%0A        for (int i = 0; i %3C nVowels; i++) %7B%0A            answer += countVowelStrings(nVowels, n - 1, i, memo);%0A        %7D%0A        return answer;%0A    %7D%0A%0A    private static int countVowelStrings(int nVowels, int n, int i, Integer%5B%5D%5B%5D memo) %7B%0A        if (n == 0) %7B%0A            return 1;%0A        %7D%0A        if (memo%5Bn%5D%5Bi%5D != null) %7B%0A            return memo%5Bn%5D%5Bi%5D;%0A        %7D%0A        int total = 0;%0A        for (int j = i; j %3C nVowels; j++) %7B%0A            total += countVowelStrings(nVowels, n - 1, j, memo);%0A        %7D%0A        memo%5Bn%5D%5Bi%5D = total;%0A        return total;
 %0A   

Solve problem 1641