python easy and a hard way | backtracking | DP |
Using backtracking\n\n    def countVowelStrings(self, n):\n        vowels = [\'a\', \'e\', \'i\', \'o\', \'u\']\n        res = []\n        idx = 0\n\n        de
**Using backtracking**\n```\n    def countVowelStrings(self, n):\n        vowels = [\'a\', \'e\', \'i\', \'o\', \'u\']\n        res = []\n        idx = 0\n\n        def rec(s, idx):\n            if len(s) == n:\n                res.append(s)\n                return\n            for i in vowels[idx:]:\n                rec(s + i, idx)\n                idx += 1\n            return res\n\t\t\t\n        return len(rec(\'\', idx))\n```\n\n**Using DP array**\n```\ndef countVowelStrings(self, n):\n        dp = [1] * 5 \n        for x in range(n-1):\n            for i in range(1, 5):\n                dp[i] = dp[i] + dp[i - 1]\n                \n        return sum(dp)\n```\n\n
['Dynamic Programming', 'Backtracking', 'Recursion', 'Python']