Leetcode 1761 Solution
This article provides solution to leetcode question 1761 (count-sorted-vowel-strings)
Access this page by simply typing in "lcs 1761" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
https://leetcode.com/problems/count-sorted-vowel-strings
Solution
class Solution:
def countVowelStrings(self, n: int) -> int:
dp = [[0 for _ in range(5)] for _ in range(n + 1)]
for i in range(5):
dp[1][i] = 5 - i
for i in range(2, n + 1):
for j in range(5):
for k in range(j, 5):
dp[i][j] += dp[i - 1][k]
return dp[n][0]