Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please explain each step and the logic behind it. HackLand Election In lections hat uso the ballot bax sys em or voting, oach voter writes
Please explain each step and the logic behind it.
HackLand Election In lections hat uso the ballot bax sys em or voting, oach voter writes name e a candidate cn a ba lo and P acos it in he ballot ox T e candidate with ho h ghes number a voto wins h ectiorIf wo or moro cane e ate; havo the same nunnber a votos, hon od candidates namie are rdered olphabetically and the last nama in the alphabatical order wins For example, vates are in the namesJoe, Mary, Mary Joe'). Each candidate received two wotes, but Mary is alphabetically later than Joe, so she wins Function Description Complete the function electionWinner in the editor below The function must return a string denoting the name of the winning candidate electionWinner has the following parameterts votes/votes 01. votesn-7an array of strings representing the names of the candidates as voted by thewater Constraints 1ins10Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started