【LeetCode】349. Intersection of Two Arrays
来源:互联网 发布:北大生命科学院知乎 编辑:程序博客网 时间:2024/06/03 13:57
题解:找相同元素不含重复值可以用set
vector<int> intersection(vector<int>& nums1, vector<int>& nums2) { set<int> st(nums1.begin(),nums1.end()); vector<int> res; for(auto a:nums2) { if(st.erase(a)){ res.push_back(a); } } return res; }
阅读全文
0 0
- leetcode 记录 349. Intersection of Two Arrays
- 349.[Leetcode]Intersection of Two Arrays
- [leetcode] 349. Intersection of Two Arrays
- Leetcode Everyday: 349. Intersection of Two Arrays
- leetcode.349. Intersection of Two Arrays
- LeetCode 349. Intersection of Two Arrays
- Leetcode 349. Intersection of Two Arrays
- leetcode 349. Intersection of Two Arrays
- leetcode 349. Intersection of Two Arrays
- LeetCode 349. Intersection of Two Arrays
- 【leetcode】 349. Intersection of Two Arrays
- Leetcode 349. Intersection of Two Arrays
- LeetCode 349. Intersection of Two Arrays
- Leetcode题解 349. Intersection of Two Arrays
- LeetCode - 349. Intersection of Two Arrays
- [Leetcode]349. Intersection of Two Arrays
- 349. Intersection of Two Arrays--LeetCode Record
- LeetCode 349. Intersection of Two Arrays
- 欢迎使用CSDN-markdown编辑器
- AtCoder Beginner 073 joisino's travel(多源最短路径Floyd|DFS)
- LeetCode 169. Majority Element and LeetCode 229. Majority Element II解题报告
- Flask笔记
- 2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛(9.9)
- 【LeetCode】349. Intersection of Two Arrays
- 重排整数
- VC科学计算器
- python下几种打开文件的方式
- Maven的安装
- 【个人笔记】突然看到的一个关于小数输出的东西,记录下来
- Web: 使用Javascript新开一个浏览器标签而不是新开一个窗口
- Java程序中Json不能解析的问题
- 深度学习基础教程——caffe环境的搭建