Open
Conversation
Added problem description and rules for unique email addresses.
Added detailed explanation and examples for unique email addresses problem. Included Python solution with time and space complexity analysis.
mamo3gr
reviewed
Mar 5, 2026
| ```py | ||
| class Solution: | ||
| def numUniqueEmails(self, emails: List[str]) -> int: | ||
| normalized_set = set() |
There was a problem hiding this comment.
メールアドレスの正規化という文脈では、canonicalize という単語もよく見かけます。
_set は _emails の方が、何が入っているか分かりやすそうです。
mamo3gr
reviewed
Mar 5, 2026
Comment on lines
+124
to
+125
| plus_ignored_local_name = re.sub(r"\+.*", "", local_name) | ||
| dot_removed_local_name = re.sub(r"\.", "", plus_ignored_local_name) |
There was a problem hiding this comment.
個人的には、正規表現よりも split("+"), replace(".", "") の方が読みやすかったです。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every valid email consists of a local name and a domain name, separated by the '@' sign. Besides lowercase letters, the email may contain one or more '.' or '+'.
For example, in "alice@leetcode.com", "alice" is the local name, and "leetcode.com" is the domain name.
If you add periods '.' between some characters in the local name part of an email address, mail sent there will be forwarded to the same address without dots in the local name. Note that this rule does not apply to domain names.
For example, "alice.z@leetcode.com" and "alicez@leetcode.com" forward to the same email address.
If you add a plus '+' in the local name, everything after the first plus sign will be ignored. This allows certain emails to be filtered. Note that this rule does not apply to domain names.
For example, "m.y+name@email.com" will be forwarded to "my@email.com".
It is possible to use both of these rules at the same time.
Given an array of strings emails where we send one email to each emails[i], return the number of different addresses that actually receive mails.
url: https://leetcode.com/problems/unique-email-addresses/description/