Optimal Game strategy-II

URL Optimal game strategy-1: https://ide.codingblocks.com/s/109417

I solved the previous question without overthinking consider it as a fluke, but when I try to answer this question I cannot think of any solution…when I googled I found that they have used a 2D array, but I cannot even do that because of n<=10000…What should I do?

value of n in test cases are less than 2000 so n^2 will … there is mistake in Constraints…

1 Like

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.