Intuition for DP solution:

We can generate all possible strings using backtracking. Lets break it into parts.

  1. use current vowel and solve for length n-1.
  2. Don’t pick the current vowel. pick next and solve for length n
Computing values for n=5

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
shivam patel

shivam patel

Part time human, Full time Software developer :D