Hello. I had recently joined codechef. I tried this as a practise problem:
CodeChef: Practical coding for everyone.
Here is my solution in Java:
CodeChef: Practical coding for everyone
Logic I used:
If the negative of minimum lead is greater than max lead then player 2 will win or player 1 will win.
Here i defined lead as Points of P1 - points of P2.
So if Lead is negative it means P2 is leading.
if Lead is positive it means P1 is leading.
I am not able to see any case where this will fail. I spent a lot of time in thinking of cases. Please help.
Thank you for helping.
1 Like