In this question there is no need of sorting but in successful submission answer everyone use sorting for array please anyone can help me out to know why everyone do sorting.the above link lead you to problem statement.
The problem asks you to maximize the score of each player. To do this each player will pick the highest number available to pick from the initial array of numbers.
That is why sorting is required. Once you have sorted the array, finding out the maximum scores for each player provided they play optimally is O(n)
sorry but i not got your point.how we can edit the original array…suppose if game is going in real life and we are provided with the cards with numbers… how we can arrange these cards in perfect order ?let we are provided with 1 3 5 7 9 4 and according to rule first sum(1+7+4) get —>12 and second sum (3+5+9) get —>17 so we will tell that first player should play second turn so player 1 should win.
can you please reply sir…i have raise one more doubt…see above reply…
And in the problem they didn’t put a test case for n=2 , ( in which both two numbers are same) , in this case the answer should be draw but i see lot of successful submissions which doesn’t handle this case and got accepted
Sorry for the late reply
The cards are not folded and each player knows where all the numbers are. They can pick any card they like. Otherwise, there is no question of optimal strategies
PS .Don’t call me sir. I am just a school student and there are lots of people much better than me
This is a question from an ongoing contest.
You cannot ask for help in this question. You can ask for solutions after the contest ends
@admin please delete this post
This post was flagged by the community and is temporarily hidden.
All necessary information is given on the problem page itself. If you feel the need to ask for further clarification, please use the comment section below the problem statement.
You will usually get a response within a few hours if the setter/tester/admin feel like the clarification sought is necessary to be provided.
Do not post these doubts on Discuss as that leads to unnecessary discussion on problems.
@carre please look into this
Read the rules before starting the contest!
is this question is from ongoing contest which i asked in starting ? does i have break any rule ?
He isn’t talking about you.
Yes sure, you can post the code for the problem here as it is from a past contest.
thanks bro but i already rectify the error and remove that error.Thanks alot