Difficulty:
Members of a club have participated in a poll to elect the next president. We know the winner has the majority of the votes (strictly more votes than other candidates combined). Given an array of the votes, determine who the next president is. Try to solve this problem in linear time.
president([ 3, 2, 1, 3, 2, 2, 1, 2, 2 ]);
2