Problem Submissions Solution

Winner of an election

Difficulty: Easy

Acceptance: %

Points: 20.00

Given an array of n names arr of candidates in an election, where each name is a string of lowercase characters. A candidate name in the array represents a vote casted to the candidate. Print the name of the candidate that received the maximum count of votes. If there is a draw between two candidates, then print lexicographically smaller name.

Topics

Companies

Articles

Examples:

Expected Time Complexity: O(n)

Expected Auxiliary Space: O(n)

Constraints:
  • 1 <= n <= 10^5
  • 1 <= |arri| <= 10^5
Companies:
Adobe Atlassian
Topics:
String Hashing
Locked Content
Access Restricted: Please Login to access the code editor and test cases.