【Leetcode_easy】884. Uncommon Words from Two Sentences
problem
884. Uncommon Words from Two Sentences
题意:只要在两个句子中单词出现总次数大于1次即可。
注意掌握istringstream/map/set的使用方法。
solution:
class Solution {
public:
vector<string> uncommonFromSentences(string A, string B) {
vector<string> res;
unordered_map<string, int> tmp;
istringstream iss(A+" "+B);//err..
while(iss >> A) tmp[A]++;
for(auto a:tmp)
{
if(a.second==) res.push_back(a.first);//err..
}
return res;
}
};
参考
1. Leetcode_easy_884. Uncommon Words from Two Sentences;
2. grandyang;
3. discuss;
完
【Leetcode_easy】884. Uncommon Words from Two Sentences的更多相关文章
- 【LeetCode】884. Uncommon Words from Two Sentences 解题报告(Python)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 字典统计 日期 题目地址:https://leetc ...
- 【Leetcode_easy】1021. Remove Outermost Parentheses
problem 1021. Remove Outermost Parentheses 参考 1. Leetcode_easy_1021. Remove Outermost Parentheses; 完
- 【Leetcode_easy】1022. Sum of Root To Leaf Binary Numbers
problem 1022. Sum of Root To Leaf Binary Numbers 参考 1. Leetcode_easy_1022. Sum of Root To Leaf Binar ...
- 【Leetcode_easy】1025. Divisor Game
problem 1025. Divisor Game 参考 1. Leetcode_easy_1025. Divisor Game; 完
- 【Leetcode_easy】1029. Two City Scheduling
problem 1029. Two City Scheduling 参考 1. Leetcode_easy_1029. Two City Scheduling; 完
- 【Leetcode_easy】1030. Matrix Cells in Distance Order
problem 1030. Matrix Cells in Distance Order 参考 1. Leetcode_easy_1030. Matrix Cells in Distance Orde ...
- 【Leetcode_easy】1033. Moving Stones Until Consecutive
problem 1033. Moving Stones Until Consecutive 参考 1. Leetcode_easy_1033. Moving Stones Until Consecut ...
- 【Leetcode_easy】1037. Valid Boomerang
problem 1037. Valid Boomerang 参考 1. Leetcode_easy_1037. Valid Boomerang; 完
- 【Leetcode_easy】1042. Flower Planting With No Adjacent
problem 1042. Flower Planting With No Adjacent 参考 1. Leetcode_easy_1042. Flower Planting With No Adj ...
随机推荐
- P3674 小清新人渣的本愿 莫队+bitset
ennmm...bitset能过系列. 莫队+bitset \(\mathcal{O}(m\sqrt n + \frac{nm}{w})\) 维护一个正向的 bitset <N> mem ...
- 阿里druid数据源配置及数据库密码加密
注意: 1.阿里默认只对用户密码解密 2.druid 1.0.16版本及以上的解密时需要同时配置publicKey 一.生成密文密码 1 前提:已经配置了jdk环境 1.生成密文密码需要准备druid ...
- HiveQL 查询
一.select ...... from 语句 1.使用正则表达式来指定列 1)从表stocks中选择symbol列和列名以price作为前缀的列 select symbol,`price.*` f ...
- BZOJ 5093: [Lydsy1711月赛]图的价值 第二类斯特林数+NTT
定义有向图的价值为图中每一个点的度数的 \(k\) 次方之和. 求:对于 \(n\) 个点的无向图所有可能情况的图的价值之和. 遇到这种题,八成是每个点单独算贡献,然后累加起来. 我们可以枚举一个点的 ...
- D. Vasya and Triangle(思维, 三角形)
传送门 题意: 给你 n, m, k, 问你是否存在一个三角形, 满足三角形的面积等于 n * m / k: 若存在, 输出YES, 且输出满足条件的三角形的三个坐标(答案有多种,则输出任意一种) ...
- mac php 安装php多版本
之前的开发,PHP的版本都是基于php7.3 .but!!! 接到一个老项目 tp3.1的.没法用php7.3 只能在装一个php5.6了.真坑爹.为啥还要TP3.1的项目.并且是刚开发的新项目. 真 ...
- linux 查看带宽瓶颈
1.首先要确定网卡带宽是多少(单位是Mbit/s) ethtool eth1 | grep Speed 2.确定当前带宽使用情况 使用 nload 工具,如果没有可以yum install nload ...
- 服务器上build.xml文件乱码解决(亲测有效)
前提条件:必须root账户登录系统,否则无权限 1. 修改/etc/sysconfig/i18n: 拷贝如下内容到文件中 #LANG="zh_CN.UTF-8" LANG=&quo ...
- Android中进度条
<ProgressBar android:id="@+id/progress_bar" android:layout_width="match_parent&quo ...
- mysql几个简单的命令记录
mysql常用命令: .登录MySQL mysql -h主机 -u用户名 -p密码 . 查看MySQL数据库的字符集 show variables like '%char%'; .查看MySQL数据表 ...