PROBLEM LINK:
DIFFICULTY:
SIMPLE
PREREQUISITES:
Math, Adhoc
PROBLEM:
Find who wins most number of rounds overall provided that, a player wins a round if that player has a bigger card than another player.
EXPLANATION:
Make a list of cards each player has by dividing them alternatively one after another.
Considering positions of cards 1, 2, 3, 4 … N(not card number), each odd position card will be given to player 1 and each even position card will be given to player 2. Sort those individual lists and for each card with same index in list, decide who won that round. Keep a count of number of wins of each player.
If count of wins of player 1 is greater than 2 then print 1 else print 2.
If count of both players are same then print draw.
AUTHOR’S AND TESTER’S SOLUTIONS:
Author’s solution can be found here