Unique Email Addresses
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
Each email address has a **local name** and a **domain name** separated by a single '@'. Mail servers normalize the local name before delivery:
- Every '.' in the local name is ignored, so "a.lice@x.com" and "alice@x.com" are the same mailbox.
- If the local name contains a '+', the '+' and everything after it (within the local name) is ignored, so "alice+spam@x.com" goes to "alice@x.com".
Neither rule applies to the domain name. Given an array emails, return how many **distinct mailboxes** actually receive mail.
Examples
Constraints
- 1 <= emails.length <= 100
- 1 <= emails[i].length <= 100
- `emails[i]` consists of lowercase letters, `'+'`, `'.'` and exactly one `'@'`
- Every local name and domain name is non-empty, and local names do not start with `'+'`
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.