Skip to content

Instantly share code, notes, and snippets.

@jeb2239
Created November 12, 2020 00:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeb2239/70602dad822c7cdf960360e4b41eb024 to your computer and use it in GitHub Desktop.
Save jeb2239/70602dad822c7cdf960360e4b41eb024 to your computer and use it in GitHub Desktop.
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