Given the results of 5 rounds of cricket between India and England, determine the team that has won strictly more matches than the other team (output draw if neither team has scored more than the other).
The problem has a straightforward solution.
Maintain two variables
eng_score, corresponding to the number of matches won by India and England respectively. Both values are initially 0. Then, iterate over the test results,
ind_scoreby 1 if India won the current match,
eng_scoreby 1 if England won the current match, and
- doing nothing if it is a draw (since neither team won the match).
At the end, output
ind_score > eng_score,
eng_score > ind_score, and
per test case.
Editorialist’s solution can be found here
Experimental: For evaluation purposes, please rate the editorial (1 being poor and 5 excellent)