I am stuck around it and unable to figure out the problem ....If anyone who faced this issue or knows the solution for it ..reply in the comments,it will be really helpful. The problem is from Codeforces Educational round 95 div2 .....Here's the Problem and this is my solution implemented using Dynamic programming.
At the end of each test case, clear out the global dp array. This might solve your issue. :)
Add condition when ind becomes greater than n
What should it be..?
0
Thanks man that worked :) ...got AC but not pretty much clear why function should return zero for ind > n
Since you are starting your traversal from 1st index so on reaching the last index it means that all the previous bosses have been killed. Now since there is no boss after n, you don't need to kill anyone, hence 0.