Dsa
Trie
Medium
Unique Email Verification
You are developing a system to validate unique email addresses. Given a list of email addresses, you need to determine if there are any duplicates based on the local part of the email before the '@' symbol. An email is considered a duplicate if another email exists in the list with the same local part (case-insensitive). Your program should print the duplicate email local part if duplicates exist; otherwise, print 'All emails are unique'.
Input:
The first line contains an integer N (1 <= N <= 10000), the number of email addresses.
The following N lines each contain an email address.
Output:
Print the duplicate email local part if duplicates exist, otherwise print 'All emails are unique'.
Example:
Input:
3
test.email+alex@gmail.com
test.email@gmail.com
testemail@gmail.com
Output:
test.email
Key concepts
trieemail validationset operations
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