【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 ...
 
随机推荐
- sublime+python3 中文环境
			
工具-编译系统-新编译系统 { "cmd": ["C:/Program Files (x86)/Python36-32/python.exe","-u ...
 - Kubernetes 学习5 kubernetes资源清单定义入门
			
一.kubernetes是有一个restful风格的 API,把各种操作对象都一律当做资源来管理.并且可通过标准的HTTP请求的方法 GET,PUT,DELETE,POST,等方法来完成操作,不过是通 ...
 - CF463D Gargari and Permutations dp
			
给定 $n<=10$ 个 $1$~$n$ 的排列,求这些排列的 $LCS$. 考虑两个排列怎么做:以第一个序列为基准,将第二个序列的元素按照该元素在第一个序列中出现位置重新编号. 然后,求一个 ...
 - WinDbg常用命令系列---查看线程调用栈命令K*简介
			
Windbg里的K*命令显示给定线程的堆栈帧以及相关信息,对于我们调试时,进行调用栈回溯有很大的帮助. 一.K*命令使用方式 在不同平台上,K*命令的使用组合如下 User-Mode, x86 Pro ...
 - Redis中的缓存雪崩与缓存穿透
			
1.缓存雪崩 1.1什么是缓存雪崩? 如果我们的缓存挂掉了,这意味着我们的全部请求都跑去数据库了. 我们都知道Redis不可能把所有的数据都缓存起来(内存昂贵且有限),所以Redis需要对数据设置过期 ...
 - TPS与QPS,以及GMV
			
TPS是指每秒处理事务的个数,处理的载体可以是单台服务器,也可以是一个服务器集群. 例如:下单接口,一秒内,下单完成次数为1000,则下单接口总 tps = 1000,共有10台服务器提供下单服务,单 ...
 - CODE FESTIVAL 2017 qual C  题解
			
传送门 \(A\) 咕咕 const int N=15; char s[N];int n; int main(){ scanf("%s",s+1),n=strlen(s+1); f ...
 - Day14:CSS垂直居中
			
verticle-align:middle vertical-align:middle实现css垂直居中是常用的方法,但是需要注意,vertical生效的前提是diaplay:inline-block ...
 - yyy
			
def delete(ps): import os filename = ps[-] delelemetns = ps[] with open(filename, encoding='utf-8') ...
 - 标准ACL详解