This is the code that I have written. However, one of the test cases is generating a TLE.
Please help.
OPTIMAL GAME STRATEGY
Hello @AbhilashaBansal,
Your code is logically correct.
But, as per the given constraints, the code will face TLE.
Reason:
The excessive number of recursive calls.
Solution:
Dynamic Programming.
Suggestion:
Solve this question again after completing DP.
Hope, this would help.