String Patterns (Also for Core/Database Intern :)
Given the length of a word (wordLen) and the maximum number of consecutive vowels that it can
contain (maxVowels), determine how many unique words can be generated. Words will consist of
English alphabetic letters a through z only. Vowels are a, e, i, o, u; consonants
are the remaining 21 letters. In the explanations, v and c represent vowels and consonants.
Complete the function calculateWays in the editor below.
calculateWays has the following parameters:
- 1.
int wordLen: the length of a word - 2.
int maxVowels: the maximum number of consecutive vowels allowed in a word
Returns
int: the number of well-formed strings that can be created, modulo 1000000007(109+7)
The result may be very large number, so return the answer modulo (109 + 7).
Note:
While the answers will be within the limit of a 32 bit integer, interim values may exceed that limit. Within the function, you may need to use a 64 bit integer type to store them.
1Example 1

2Example 2

3Example 3
Constraints
Limits and guarantees your solution can rely on.
- 1 ≤ wordLen ≤ 2500
- 0 ≤ maxVowels ≤ n