Created
November 12, 2020 00:24
-
-
Save jeb2239/70602dad822c7cdf960360e4b41eb024 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Solution: | |
# you need startIdx for this prob | |
def countVowelStrings(self, n: int) -> int: | |
vowels = ['a','e','i','o','u'] | |
result=[] | |
def cvs(curr,n,startIdx): | |
if n==1: | |
result.append(curr) | |
return 1 | |
nways=0 | |
for i in range(startIdx,5): | |
nways+=cvs(curr+vowels[i],n-1,i) | |
return nways | |
total=0 | |
for i,v in enumerate(vowels): | |
total+=cvs(v,n,i) | |
print(result) | |
return total | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment