Dsa
Hashing
Warm-up
Identify Duplicated Usernames
You are tasked with finding duplicate usernames from a list of names. Each username is a string, and you need to determine how many usernames are duplicated in the list.
Input format:
- The first line contains an integer N (1 ≤ N ≤ 1000), the number of usernames.
- The next N lines each contain a string, the username.
Output format:
- A single integer representing the count of duplicated usernames.
Example Input:
5
user1
user2
user1
user3
user2
Example Output:
2
Key concepts
hashingstringssets
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