Difficulty in converting recursive solution to memoization / top-down DP

Правка en2, от MoonKnight9031, 2022-01-27 08:24:58

In some Dynamic Programming Problems, I am able to code the recursive solution but I find it hard to convert it into Top-Down DP or Memoization. For example :- This is a problem from yesterday's Codechef Starters Contest:- Problem Link

Below is my Recursive Code to the problem:-

My Code

It would be helpful if someone could suggest me some ideas on how to do so.

Теги help, dynamic programming, backtracking, recursion

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский MoonKnight9031 2022-01-27 08:24:58 78 (published)
en1 Английский MoonKnight9031 2022-01-27 08:21:14 1721 Initial revision (saved to drafts)