C++ / 1 line / mathematical solution / with brief explanations
We have counts of a + e + i + o + u = n\nTherefore, we can use combination with repetition formula to solve it as:\nanswer = H(5, n) = C(5 + n - 1, n) = C(4 + n
We have counts of a + e + i + o + u = n\nTherefore, we can use combination with repetition formula to solve it as:\nanswer = H(5, n) = C(5 + n - 1, n) = C(4 + n, n) = C(n + 4, 4) = (n+4) * (n+3) * (n+2) * (n+1) / 4!\n\nMore information of combination with repetition formula can be found here:\nhttps://en.wikipedia.org/wiki/Combination#Number_of_combinations_with_repetition\nThe notation of H above corresponds to the double parentheses in the link. The transformation of H and C is also included in the wiki page.\n\n```\nclass Solution {\npublic:\n    int countVowelStrings(int n) {\n        return (n+4) * (n+3) * (n+2) * (n+1) / 24;\n    }\n};\n```
[]