Election Winner
Election Winner
The candidate with the highest number of votes wins the election;
If two or more candidates have the same number of votes , then the tied candidates’ names are ordered
alphabetically and the last name wins.
Complete the electionWinner function in your editor. It has 1 parameter; an array of strings , votes ,
describing the votes in the ballot box. This function must review these votes and representing the name
of the winning candidate.
Input Format
Locked stub code in the editor reads the following input from stdin and passes it to the function:
The first line contains an integer, n, denoting the size of the votes array.
Each line i of the n subsequent lines (where 0 <= i < n ) of strings contains a citizen’s vote in the form of
a candidate’s name.
Constraints
Output Format
Your function must return a string denoting the name of the winner. This is printed to stdout by the
locked stub code in your editor.
Sample Input 1
10
Alex
Michel
Harry
Dave
Michel
Victor
Harry
Alex
Mary
Mary