LeetCode 349 Intersection of Two Arrays
来源:互联网 发布:招聘程序员的公司 编辑:程序博客网 时间:2024/06/04 22:30
用set排重
class Solution {public: vector<int> intersection(vector<int>& nums1, vector<int>& nums2) { set<int> myset1, myset2; for (int i = 0; i < nums1.size(); i++) { myset1.insert(nums1[i]); } for (int i = 0; i < nums2.size(); i++) { myset2.insert(nums2[i]); } vector<int> ans; for (set<int>::iterator it = myset1.begin(); it != myset1.end(); it++) { if (myset2.count(*it)) { ans.push_back(*it); } } return ans; }};
0 0
- Leetcode-349 Intersection of Two Arrays
- leetcode 349 Intersection of Two Arrays C++
- LeetCode 349 Intersection of Two Arrays
- LeetCode-349&350.Intersection of Two Arrays
- LeetCode-349 Intersection of Two Arrays
- leetcode-Intersection of Two Arrays-349
- 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(java)
- Leetcode 349 Intersection of Two Arrays
- LeetCode No.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
- 2016 Multi-University Training Contest 4 解题报告
- ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务解决
- Python中的序列复制问题
- Java堆和栈的区别
- 为什么wait, notify 和 notifyAll这些方法不在thread类里面?
- LeetCode 349 Intersection of Two Arrays
- PyGobject(五十六)布局容器之TreeView(上)
- 【bzoj2809】 Apio2012—dispatching
- 【初级教程】—Dubbo的配置及启动
- java名词解释
- HDU 3468 双bfs+二分图
- IE浏览器BUG全览
- 数据结构11.二叉树
- MySQL必知必会笔记(一)基础知识和基本操作