Tap here to switch tabs
Problem
Submissions

Problem: Count Vowels Permutation

med
30 min
Try to solve the Count Vowels Permutation problem.

Statement

Given an integer n, return the number of valid strings of length n that can be formed using lowercase vowels ('a', 'e', 'i', 'o', 'u') according to the following rules:

  • Each vowel 'a' may only be followed by an 'e'.

  • Each vowel 'e' may only be followed by an 'a' or an 'i'.

  • Each vowel 'i' may not be followed by another 'i'.

  • Each vowel 'o' may only be followed by an 'i' or a 'u'.

  • Each vowel 'u' may only be followed by an 'a'.

Since the answer may be very large, return it modulo 109+710^9 + 7.

Constraints:

  • 1≤n≤2⋅1041 \le n \le 2 \cdot 10^4

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Count Vowels Permutation

med
30 min
Try to solve the Count Vowels Permutation problem.

Statement

Given an integer n, return the number of valid strings of length n that can be formed using lowercase vowels ('a', 'e', 'i', 'o', 'u') according to the following rules:

  • Each vowel 'a' may only be followed by an 'e'.

  • Each vowel 'e' may only be followed by an 'a' or an 'i'.

  • Each vowel 'i' may not be followed by another 'i'.

  • Each vowel 'o' may only be followed by an 'i' or a 'u'.

  • Each vowel 'u' may only be followed by an 'a'.

Since the answer may be very large, return it modulo 109+710^9 + 7.

Constraints:

  • 1≤n≤2⋅1041 \le n \le 2 \cdot 10^4