Dsa
Hashing
Easy
Distributed Request Tracker
In a distributed system, multiple servers process requests. Each log entry consists of a ServerID and a RequestID. Your task is to find the RequestID that was processed by the highest number of *distinct* servers. If multiple requests have the same maximum count of distinct servers, return the one that is lexicographically smallest.
Input Format:
The first line contains an integer N, the number of log entries.
The next N lines each contain two strings: ServerID and RequestID.
Output Format:
A single string representing the RequestID with the most unique servers.
Example:
Input:
4
S1 R100
S2 R100
S1 R200
S3 R100
Output:
R100
(Explanation: R100 is on S1, S2, S3 [3 servers]. R200 is only on S1 [1 server].)
Key concepts
hash mapsettie-breaking
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now