1641. Count Sorted Vowel Strings

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 1641

class Solution:
    def countVowelStrings(self, n: int) -> int:
        f = [1] * 5
        for _ in range(n - 1):
            s = 0
            for j in range(5):
                s += f[j]
                f[j] = s
        return sum(f)