DP : Time O(N) and Constant space
Intuition\n Describe your first thoughts on how to solve this problem. \n     \t     a  e  i  o  u\n     n=1   1  1  1  1  1  /a, e, i, o, u\n     n=2   5  4  3
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n     \t     a  e  i  o  u\n     n=1   1  1  1  1  1  /a, e, i, o, u\n     n=2   5  4  3  2  1  /a-> aa,ae,ai,ao,au | e-> ee,ei,eo,eu | i-> ii,io,iu | o-> oo,ou | u-> uu\n     n=3   15 10 6  3  1\n\n     Logic: \n     in n=3, e will be ((previous \'e\') = 4)  + (count of next element \'i\' = 6) \n\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n    O(N)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n    O(1)\n\n# Code\n```\nclass Solution {\npublic:\n    int countVowelStrings(int n) {\n        int a = 1, e = 1, i = 1, o = 1, u = 1;\n        n--;\n        while (n--){\n            o += u;\n            i += o;\n            e += i;\n            a += e;\n        }\n        return a + e + i + o + u;\n    }\n};\n```
['C++']