hi @zargus firstly, why is the class public? it might lead to compilation error.
Coming to the problem with your code, well read the problem statement carefully. You need to add scores of individual players in each round. ie.
Let, s(Pij) denote the score of player i in round j.
then, for any j<=n the score is the sum of all previous rounds plus the current score and then you need to find the lead.
so for player 1 in round 5:
See this image carefully(belongs to the question page itself):
As you can see
what you have done:
You have found the lead using scoresheet ie the first table itself. But thats not the actual score! that’s just the score for that particular round.
what you need to do:
Refer to the second table and see how actual score comes.
for player 1 the score after round 2 is 140+89, you have considered only 89.
for player 2 the score after round 3 is 82+134+110 you have considered only 110
So, basically just maintain 2 variables say A and B denoting the total score. Instead of comparing (p1-p2) > lead in your code. first do,
A=A+p1 and B=B+p2 and then compare A and B;
And in short, this modification in your code should get you accepted!
Hope this helps!