当前位置:网站首页>929. 独特的电子邮件地址
929. 独特的电子邮件地址
2022-06-09 23:18:00 【julia点c】
929. 独特的电子邮件地址
今天的每日为简单题,思路为:处理每段字符串,将‘+’和‘@’后的字符串拼接在一起形成目标串,为了防止出现重复目标串,使用哈希表去重,最后返回哈希表的大小即可,具体代码如下
class Solution {
public:
int numUniqueEmails(vector<string>& emails) {
unordered_set<string>S;
for(auto&s:emails)
{
int k=s.find('@');
auto a=s.substr(0,k);
auto b=s.substr(k+1);
string c;
for(auto&x:a)
{
if(x=='+') break;
else if(x!='.') c+=x;
}
S.insert(c+'@'+b);
}
return S.size();
}
};
边栏推荐
- Two tower model: Ernie gram pre training and fine-tuning matching
- 你了解单例模式吗?反正我不了解。
- 2022 practice questions and mock exam of quality controller municipal direction general basic (quality controller) examination
- leetcode547. Number of provinces (medium, find the number of connected components)
- Mazhiqiang: research progress and application of speech recognition technology -- RTC dev Meetup
- 没有项目管理经验,可以参加PMP考试?
- How about opening an account at CICC securities? Is it safe? Account opening
- Implementing Lmax disruptor queue from scratch (II) analysis of consumption dependency principle among multiple consumers and consumer groups
- C # WPF background dynamic add control (Classic)
- 騰訊-NCNN簡介
猜你喜欢

不能在此路径中使用此配置节,如果在父级别上锁定了该节,便会出现这种情况的解决办法

bias、variance介绍

leetcode695. Maximum area of the island (medium)

"Leak detection and vacancy filling" Android internship interview knowledge points (II)

opencv体系结构

网络状态的起起伏伏

Opencv architecture

蓝桥杯_分割立方体_组合数学_加法原理

Remove packages and dependencies using yum

Microsoft Word tutorial "4", how to apply styles and themes in word?
随机推荐
Install idea
黄希庭:心理学的研究要走中国人自己的道路,要做中国化的心理学研究
剖析虚幻渲染体系(15)- XR专题
Multiplier: how to build a circuit like Lego (Part 2)?
打破那面镜子,做回真正的自己(深度好文)
荐书 | 即使是来自星星的你,我也想去靠近
Game installation, downloading and updating no unveils the mystery of future games
"Leak detection and vacancy filling" Android internship interview knowledge points (II)
poi 导出excel实战
堆叠线缆的光模块与普通光模块区别
Two tower model: Ernie gram pre training and fine-tuning matching
Is it necessary to get PMP?
[volume guide] mendeley document management tool tutorial
“当你不再是程序员,很多事会脱离掌控”—— 对话全球最大独立开源公司SUSE CTO
Huangxiting: psychological research should follow the path of the Chinese people, and should do psychological research with Chinese characteristics
辐射亮度与表观反射率的转换
bias、variance介绍
Deploy MySQL based on statefulset in kubernetes (Part 1)
Py6S配置教程(win10 ×64)
Virtual machine environment configuration record 1