Java DP O(n) time Easy to understand
time: O(n)\nspace: O(1)\njust think about the mathematical induction\nif we know all the string of len k, so the string of len k + 1 will be\n1 add a before all
time: O(n)\nspace: O(1)\njust think about the mathematical induction\nif we know all the string of len k, so the string of len k + 1 will be\n1 add a before all string of len k\n2 add e before  the string of len k, which is starts with or after e\n3 add i before  the string of len k, which starts with or after i\n4 add o before  the string of len k, which starts with or after o\n5 add u before  the string of len k, which starts with or after u\n```\nclass Solution {\n    public int countVowelStrings(int n) {\n        int a = 1, e = 1, i = 1, o = 1, u = 1;\n        while(n > 1) {\n\t\t\t// add new char before prev string\n            a = (a + e + i + o + u); // a, e, i, o, u -> aa, ae, ai, ao, au\n            e = (e + i + o + u); // e, i, o, u -> ee, ei, eo, eu\n            i = (i + o + u); // i, o, u -> ii, io, iu\n            o = (o + u); // o, u -> oo, ou\n            u = (u);; // u -> uu\n            n--;\n        }\n        \n        return a + e + i + o + u;\n    }\n}\n```
[]