Not passing last TC.
My code: https://ide.codingblocks.com/s/99382
problem: https://hack.codingblocks.com/contests/c/586/1082
Thanks!
Not passing last TC.
My code: https://ide.codingblocks.com/s/99382
problem: https://hack.codingblocks.com/contests/c/586/1082
Thanks!
actually your recusrion is creating a stack overflow , because at each point it is separating into two different functiions , there dept is going upto 2^n . its quite large.
But I’ve used memoization.
Anyways whats the fix?
the fix is to create a dp table and fill it in down to up approach
see this sol;-
Can you give me some tips. Most of the times I am able to come up with a recursive + memo solution but can’t convert it into bottom up dp… Any guidance?
yes actually its just a reverse thing , just opossite , when you come up with a recursive solution , we can understand on what other terms it is depending upon , apply the same thing using dp table, fill in the base cases , and loop
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.