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的更多相关文章

  1. 【LeetCode】884. Uncommon Words from Two Sentences 解题报告(Python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 字典统计 日期 题目地址:https://leetc ...

  2. 【Leetcode_easy】1021. Remove Outermost Parentheses

    problem 1021. Remove Outermost Parentheses 参考 1. Leetcode_easy_1021. Remove Outermost Parentheses; 完

  3. 【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 ...

  4. 【Leetcode_easy】1025. Divisor Game

    problem 1025. Divisor Game 参考 1. Leetcode_easy_1025. Divisor Game; 完

  5. 【Leetcode_easy】1029. Two City Scheduling

    problem 1029. Two City Scheduling 参考 1. Leetcode_easy_1029. Two City Scheduling; 完

  6. 【Leetcode_easy】1030. Matrix Cells in Distance Order

    problem 1030. Matrix Cells in Distance Order 参考 1. Leetcode_easy_1030. Matrix Cells in Distance Orde ...

  7. 【Leetcode_easy】1033. Moving Stones Until Consecutive

    problem 1033. Moving Stones Until Consecutive 参考 1. Leetcode_easy_1033. Moving Stones Until Consecut ...

  8. 【Leetcode_easy】1037. Valid Boomerang

    problem 1037. Valid Boomerang 参考 1. Leetcode_easy_1037. Valid Boomerang; 完

  9. 【Leetcode_easy】1042. Flower Planting With No Adjacent

    problem 1042. Flower Planting With No Adjacent 参考 1. Leetcode_easy_1042. Flower Planting With No Adj ...

随机推荐

  1. MySQL常用五大引擎的区别

    MyISAM: 如果你有一个 MyISAM 数据表包含着 FULLTEXT 或 SPATIAL 索引,你将不能把它转换为使用 另一种引擎,因为只有 MyISAM 支持这两种索引. BLOB: 如果你有 ...

  2. bash: cd: too many arguments 报错

    路径名或者变量有空格时候,会造成参数太多的错误提示 解决方法:把空格的地方用引号包括起来

  3. C用malloc 向系统申请一个大小为n*4个字节的内存块

    #include <stdio.h> #include <malloc.h> void out(int *p, int n){ int i; for(i=0;i<n;i+ ...

  4. Codevs 1070 普通递归关系(矩阵乘法)

    1070 普通递归关系 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 大师 Master 题目描述 Description 考虑以下定义在非负整数n上的递归关系 f(n) = f0 ...

  5. 51 Nod 1430 奇偶游戏(博弈)

    1430 奇偶游戏 题目来源: CodeForces 基准时间限制:1 秒 空间限制:131072 KB 分值: 160 难度:6级算法题 收藏 关注 有n个城市,第i个城市有ai个人.Daenery ...

  6. Processing 中自定义旋转的实现

    一.首先是关键概念在 Processing 中希望处理圆周上的点需要 旋转公式:x = 旋转中心 + 旋转半径 x cos(旋转角度);y = 旋转中心 + 旋转半径 x sin(旋转角度): 用这一 ...

  7. Java 日期工具类(日期,月份加减等)--转

    package util; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.C ...

  8. CAS5.3服务器搭建及SpringBoot整合CAS实现单点登录

    1.1 什么是单点登录 单点登录(Single Sign On),简称为 SSO,是目前比较流行的企业业务整合的解决方案之一.SSO的定义是在多个应用系统中,用户只需要登录一次就可以访问所有相互信任的 ...

  9. c# lock TransactionScope

    c# lock TransactionScope TransactionOptions option = new TransactionOptions(); //option.IsolationLev ...

  10. markdown 插入链接

    插入链接 []里面写链接的标题或描述,可以省略不加不写 , () 里面是链接,必须有必须写 例如 [百度](https://www.baidu.com) 百度 参考文章 Markdown 插入链接