Dsa
Trie
Easy
Unique Email Counter
Your task is to count the number of unique email addresses. An email is considered unique if the local part (before the '@') is distinct, ignoring '.'s and any characters after a '+' sign. Implement a Trie to store the processed local parts of emails.
Input Format:
The first line contains an integer n (1 ≤ n ≤ 1000), the number of emails.
Each of the next n lines contains a single email address.
Output Format:
Print a single integer — the count of unique emails.
Example:
Input:
4
test.email@example.com
testemail@example.com
test.email+alex@leetcode.com
test.email@leetcode.com
Output:
2
Key concepts
trieemail parsingcounting
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