Java | One-line Solution | Math | O(1) and O(1)
Mathematical Explanation:\nThe process we count valid results can be considered as to count combinations when sampling n elements with replacement from the set 
Mathematical Explanation:\nThe process we count valid results can be considered as **to count combinations when sampling *n* elements with replacement from the set** *S* = { a, e, i, o, u }. Note, we only consider the combinations of the selected elements.\n\nFor example, if n = 3, { a, a, e } and { e, a, a } are considered as the same case, because once the elements are determined, their order is determined by the rule of lexicographically sorting. That\'s why we only need to consider the combination results rather than the permutation.\n\nTo count the combination results of sampling ***n*** elements with replacement from a set S, where |S| = ***m***, we have the formula: ***Result = C(m + n - 1, n)***\n\nFor this question, we have:\nresult = C( |S| + n - 1, n) = C(5 + n - 1, n) = C(n + 4, n) = C(n + 4, 4)\n\nSince the max value of ***n*** is 50, the maximum cumulative product is 54 * 53 * 52 * 51 = 7,590,024, which is within the valid range of **int**, so we can directly write our code as follows:\n\n```\npublic int countVowelStrings(int n) {\n  return (n + 4) * (n + 3) * (n + 2) * (n + 1) / 24;\n}\n```
['Math', 'Java']