Need help with solving IGAME

Link to problem statement

I have this code submission
When I printed the first rows and columns of DP table, the output looked like this:
011111111111111111111
110111111111111111111
101111111111111111111
111110111111111111111
111111101111111111111
111011111111111111111
111111111101111111111
111101111111011111111
111111111111111111111
111111111111111011111
111111011111111110111
111111111111111111111
111111101111111111110
111111111111111111111
111111111111111111111
111111111011111111111

It looked very similar to the output of correct submission by bkalman.

I have tried adjusting the size of DP table, alternating the m,n,p,q and in/decrementing each.
Can anyone please help me what I am doing wrong in my code, or what edge cases I may be missing?

1 Like