[leetcode]Unique Email Addresses

简单题

class Solution:
    def numUniqueEmails(self, emails: List[str]) -> int:
        result = set()
        for email in emails:
            splits = email.split('@')
            name = splits[0] # to remove '.' & contents after '+'
            domain = splits[1]

            normName = ''
            for char in name:
                if char == '+':
                    break
                elif char == '.':
                    continue
                else:
                    normName += char

            result.add(normName + '@' + domain)

        return len(result)
                

  

上一篇:zabbix_agentd.conf配置文件详解


下一篇:1041 Be Unique (20分)