Tap here to switch tabs
Problem
Submissions

Problem: Unique Email Groups

Try to solve the Unique Email Groups problem.

Statement

Given an array of strings emails where each string represents an email address, return the number of distinct email addresses that actually receive mail after normalization.

Each email address contains a local name and a domain name separated by an '@' character.

The normalization rules are as follows:

  • Local Name Rules:

    • Characters are case insensitive, so all uppercase letters are converted to lowercase.

    • Any periods '.' are ignored and removed.

    • If a plus character '+' appears, all characters following the first '+' are ignored and removed.

  • Domain Name Rules:

    • Characters are case insensitive, so all uppercase letters are converted to lowercase.

    • Periods '.' are preserved.

Two email addresses are considered part of the same group if their normalized forms are identical.

Constraints:

  • 1≤1 \le emails.length ≤1000\le 1000

  • 1≤1 \le emails[i].length ≤100\le 100

  • emails[i] consists of lowercase and uppercase English letters, digits, and the characters '.' , '+', and '@'.

  • Each emails[i] contains exactly 11 '@' character.

  • All local and domain names are non-empty; local names do not start with '+'.

  • Domain names end with the ".com" suffix and contain at least 11 character before ".com".

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Unique Email Groups

Try to solve the Unique Email Groups problem.

Statement

Given an array of strings emails where each string represents an email address, return the number of distinct email addresses that actually receive mail after normalization.

Each email address contains a local name and a domain name separated by an '@' character.

The normalization rules are as follows:

  • Local Name Rules:

    • Characters are case insensitive, so all uppercase letters are converted to lowercase.

    • Any periods '.' are ignored and removed.

    • If a plus character '+' appears, all characters following the first '+' are ignored and removed.

  • Domain Name Rules:

    • Characters are case insensitive, so all uppercase letters are converted to lowercase.

    • Periods '.' are preserved.

Two email addresses are considered part of the same group if their normalized forms are identical.

Constraints:

  • 1≤1 \le emails.length ≤1000\le 1000

  • 1≤1 \le emails[i].length ≤100\le 100

  • emails[i] consists of lowercase and uppercase English letters, digits, and the characters '.' , '+', and '@'.

  • Each emails[i] contains exactly 11 '@' character.

  • All local and domain names are non-empty; local names do not start with '+'.

  • Domain names end with the ".com" suffix and contain at least 11 character before ".com".