Laptop
Practice
4.2 (12 votes)
Hash table
Hashmap
Basic programming
Easy
Open
Approved
Problem
85% Success 4152 Attempts 20 Points 5s Time Limit 256MB Memory 1024 KB Max Code

Bob and Khatki recently started a business. They sell computers at moderate rates. To grow their business they need to know which company’s laptops are in demand. You are given description of N laptops which are sold out. Each laptop is described by their company name. Can you help them figure out which company’s laptops are in demand. The company in demand is the one whose laptops are being sold more. If there are multiple such companies print the one which is lexicographically smallest.

Input:

First line of input contains N, number of responses of people. Next N lines contains company name of laptop.

Output:

Print the company name people preferred most. In case of tie print the lexographically smallest answer.

Constraints:

1 &le N ≤ 105

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
8 votes
Tags:
Hash functionImplementationBinary search treeData StructuresHash tableOpenApprovedEasy
Points:20
150 votes
Tags:
EasyOpenHash functionHash table
Points:20
154 votes
Tags:
EasyOpenHash functionHash table