---
# System prepended metadata

title: Leetcode 1641. Count Sorted Vowel Strings

---

# Leetcode 1641. Count Sorted Vowel Strings

## 題解

### 前綴和 + DP

![](https://hackmd.io/_uploads/HyAooBYe6.png)

#### Bottom up

```python!
class Solution:
    def countVowelStrings(self, n: int) -> int:
        dp = [0] + [1 for i in range(5)]
        for i in range(n):
            for j in range(5):
                dp[j+1] += dp[j]
        return dp[-1]
```