Skip to content

Practice Count Vowels Permutation

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Hard#1220
LeetCode Problem

Count Vowels Permutation

Problem Statement

Count strings of length n using only a, e, i, o, and u. For each adjacent pair, an a may be followed only by e; e only by a or i; i by any vowel except i; o only by i or u; and u only by a. Return the count modulo 10^9 + 7.

Source: Count Vowels Permutation on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
n = 1
Output
5

# Example 2

Input
n = 2
Output
10

# Example 3

Input
n = 5
Output
68

Constraints

1 <= n <= 2 * 10^4

Related LeetCode Problems

Practice more problems similar to Count Vowels Permutation.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.