Question: Given an array [0.. n-1], where each element of the array represents a vote in the election, assume that each vote (i.e., element in the
Given an array [0.. n-1], where each element of the array represents a vote in the election, assume that each vote (i.e., element in the array) represents an ID of the chosen candidate. Also, assume that the number of candidates are less than the number of votes. Write an efficient algorithm with time complexity of O(n) to determine the winner of the election.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
