Given an integer `n`, return the number of strings of length `n` that consist only of the vowels `a`, `e`, `i`, `o`, `u` and are lexicographically sorted. A string is sorted when every character is the same as or comes before the next one in the alphabet.
Given an integer n, return the number of strings of length n that consist only of the vowels a, e, i, o, u and are lexicographically sorted. A string is sorted when every character is the same as or comes before the next one in the alphabet.
Example 1:
Input: {"n":1}
Output: 5
Constraints:
1≤n≤50
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"n":1}
dp[v] = sorted strings of the row's length that start with vowel v (target n = 1)
length
a
e
i
o
u
total
L=1
1
1
1
1
1
…
Length 1: exactly one string starts with each vowel ("a", "e", "i", "o", "u"), so dp = [1,1,1,1,1]. dp[v] counts sorted strings that start with vowel v.