ps | |
---|---|
링크 | leetcode.com/… |
출처 | LeetCode |
문제 번호 | 929 |
문제명 | Unique Email Addresses |
레벨 | Easy |
분류 |
기초 |
시간복잡도 | O(nm) |
인풋사이즈 | n<=100, m<=100 |
사용한 언어 | Python |
제출기록 | 52ms / 14.3 MB |
최고기록 | 28ms |
해결날짜 | 2021/09/27 |
"""Solution code for "LeetCode 929. Unique Email Addresses".
- Problem link: https://leetcode.com/problems/unique-email-addresses/
- Solution link: http://www.teferi.net/ps/problems/leetcode/929
"""
from typing import List
class Solution:
def numUniqueEmails(self, emails: List[str]) -> int:
emailSet = set()
for email in emails:
local, domain = email.split('@')
forwardedLocal = local.split('+')[0].replace('.', '')
emailSet.add((forwardedLocal, domain))
return len(emailSet)