From 0884b95d4e1965487c813b1dd84b86156cd3853f Mon Sep 17 00:00:00 2001 From: Vitor Oliveira Date: Sun, 16 May 2021 22:12:36 -0700 Subject: [PATCH] add short explanation --- dynamic_programming/count_sorted_vowel_strings.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dynamic_programming/count_sorted_vowel_strings.rb b/dynamic_programming/count_sorted_vowel_strings.rb index 0696006..e6a9fbe 100644 --- a/dynamic_programming/count_sorted_vowel_strings.rb +++ b/dynamic_programming/count_sorted_vowel_strings.rb @@ -30,6 +30,17 @@ # Approach: Using Recursion + Memoization, Top Down Dynamic Programming # +# +# Algorithm: Dynamic Programming state transition. +# +# F(0) = 1 +# F(n)a = F(n-1)a + F(n-1)e + F(n-1)i + F(n-1)o +F(n-1)u +# F(n)e = F(n-1)e + F(n-1)i + F(n-1)o + F(n-1)u +# F(n)i = F(n-1)i + F(n-1)o +F(n-1)u +# F(n)o = F(n-1)o + F(n-1)u +# F(n)u = F(n-1)u +# + # @param {Integer} n # @return {Integer}