Count Sorted Vowel Strings

Medium

Description

Given an integer n, return the number of strings of length n that consist only of vowels and are lexicographically sorted.

Examples

Input:n = 2
Output:15
Explanation:

aa,ae,ai,ao,au,ee,ei,eo,eu,ii,io,iu,oo,ou,uu.

Input:n = 1
Output:5
Explanation:

Edge case with minimal input.

Input:n = 3
Output:35
Explanation:

For length 3, the requirement is 3 vowels in non-decreasing order. Examples include: aaa, aae, aai, aao, aau, aee, aei, aeo, aeu, aii, aio, aiu, aoo, aou, auu, eee, eei, eeo, eeu, eii, eio, eiu, eoo, eou, euu, iii, iio, iiu, ioo, iou, iuu, ooo, oou, ouu, uuu. This demonstrates how the count grows significantly as n increases due to the combinatorial nature of the problem.

Constraints

  • 1 ≤ n ≤ 50

Ready to solve this problem?

Practice solo or challenge other developers in a real-time coding battle!