【Leetcode_easy】929. Unique Email Addresses
problem
solution:
class Solution {
public:
int numUniqueEmails(vector<string>& emails) {
unordered_set<string> tmp;
for(auto email:emails)
{
std::size_t at = email.find('@');
string local = "";
for(int i=; i<at; i++)
{
if(email[i]=='.') ;
else if(email[i]=='+') break;
else local += email[i];
}
tmp.insert(local+'@'+email.substr(at+));//errr...
}
return tmp.size();
}
};
参考
1. Leetcode_easy_929. Unique Email Addresses;
完
【Leetcode_easy】929. Unique Email Addresses的更多相关文章
- 【leetcode】929. Unique Email Addresses
题目如下: Every email consists of a local name and a domain name, separated by the @ sign. For example, ...
- 【LeetCode】929. Unique Email Addresses 解题报告(Python)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 set + 字符串操作 参考资料 日期 题目地址:h ...
- 929. Unique Email Addresses
929. Unique Email Addresses Easy 22766FavoriteShare Every email consists of a local name and a domai ...
- [leetcode] 929. Unique Email Addresses (easy)
统计有几种邮箱地址. 邮箱名类型:local@domain 规则:1. local中出现"."的,忽略. a.bc=abc 2. local中出现"+"的,+以 ...
- [LeetCode] 929. Unique Email Addresses 唯一的电邮地址
Every email consists of a local name and a domain name, separated by the @ sign. For example, in ali ...
- [LeetCode] 929. Unique Email Addresses 独特的邮件地址
Every email consists of a local name and a domain name, separated by the @ sign. For example, in ali ...
- LeetCode 929.Unique Email Addresses
Description Every email consists of a local name and a domain name, separated by the @ sign. For exa ...
- LeetCode 929 Unique Email Addresses 解题报告
题目要求 Every email consists of a local name and a domain name, separated by the @ sign. For example, i ...
- LeetCode 929. Unique Email Addresses (独特的电子邮件地址)
题目标签:String 题目说明 有两个规则针对于 local name. 所以先把local name 和 domain name 分开. 两个规则是: rule 1:'.' 会被去除. (利用re ...
随机推荐
- Spring入门(四)——整合Mybatis
1. 准备jar包及目录结构 2. 配置db.properties driver = com.mysql.jdbc.Driver url = jdbc:mysql://127.0.0.1:3306/H ...
- The Last Goodbye 电影《霍比特人3:五军之战》插曲
https://music.163.com/#/song?id=29755223 I saw the light fade from the sky我看到天空褪去色彩On the wind I hea ...
- learning java Runtime类中的exec
var rt = Runtime.getRuntime(); // 类c语言当中的system()函数. rt.exec("notepad.exe");
- cube.js 学习(一)简单项目创建
cube.js 是一个很不错的模块化分析框架,基于schema生成sql 同时内置可代码生成,可以快速的搞定 web 分析应用的开发 安装cli 工具 npm install -g cubejs-cl ...
- CSS3 过渡 (transition )
transition 属性是一个简写属性,用于设置四个过渡属性: 1.transition-property 设置过渡效果的 CSS 属性的名称.一般写all 2.transition-durat ...
- subcode
在思考.查阅subcode时,我发现Magma,Sage Math软件都提供了具体的命令和例子,对subcode的认识比较具象. 例如:Sage Math中有如下命令: C1 = codes.Hamm ...
- 网格布局 grid
推荐阅读:http://www.ruanyifeng.com/blog/2019/03/grid-layout-tutorial.html 1. 启动网格布局 div { display: grid; ...
- 第12组 团队Git现场编程实战
分工及贡献 组内有三人去考证了,只剩下6人 组员 分工 贡献比例 王永福 前后端,爬虫,博客主体 30% 孙承恺 建模,算法设计,统筹 18% 邱畅杰 爬虫 15% 徐祖豪 前端数据可视化 13% 张 ...
- Python中文件读写read,readline,readlines函数的区别?
read 每次会读取整个文件 readline 每次读取一行信息 readlines 读取整个文件返回一个列表,列表每个元素代表一行
- RNN梯度消失和爆炸的原因 以及 LSTM如何解决梯度消失问题
RNN梯度消失和爆炸的原因 经典的RNN结构如下图所示: 假设我们的时间序列只有三段, 为给定值,神经元没有激活函数,则RNN最简单的前向传播过程如下: 假设在t=3时刻,损失函数为 . 则对于一 ...