Showing answer as false


this is my code. it hsows wrong answer for 2 test cases and run -error for 1 test case

2 test cases passed but 1 test case shows run-error https://ide.codingblocks.com/s/235101

hello @tanjuljain19
I have checked ur submission ,it is showing 100 points.
try submitting it again.

I have solved it using recursion ,it got submitted and passed all test cases but I want to know the problem with the dp solution

image

check the constraint , dp solution will give memory issue (if we use 2d array).
otherwise tle beause 5000 * 10^6=> 5*10^9. which is 50 sec.

so i dont think dp solution work for this problem.

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.