Ctrl K

Sorted Vowel Words

Medium
Consider words of length length made only of the letters a, e, i, o, u. A word is sorted if every letter comes no earlier in the alphabet than the one before it (repeats are allowed). Return the number of sorted words of length length.
Example 1
length=2 → 15

The words are aa, ae, ai, ao, au, ee, ei, eo, eu, ii, io, iu, oo, ou, uu: 15 in total. A word like "ia" does not count, since i comes after a.

Example 2
length=1 → 5

Each of the five vowels on its own is a sorted word.

Example 3
length=5 → 126
Constraints
  • 1 ≤ length ≤ 50
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsCounting Grid Routes MediumNobody Gets Their Own Gift MediumSegments on a Dotted Line MediumVowels Across All Pieces MediumWalks of Exactly k Steps Medium
loading Python…
Input
length=2
Expected
15

Run checks the first 3 tests in your browser. Submit checks all 27 tests on the server, hidden ones included.