IPL dynamic programming

i need help where i.m doing mistake.

Try writing a Bottom Up Iterative code, N=10^6 may give stack-overflow at large cases.

sir none of test case is running in top down approach…i think there is problem in my logic.

Your code runs on the sample test case, try writing a bottom up algo, you make two calls in worst case and n is 10^6, recursion stack may overflow.

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.