349. Intersection of Two Arrays
来源:互联网 发布:查看linux下的用户 编辑:程序博客网 时间:2024/06/11 13:00
class Solution {public: vector<int> intersection(vector<int>& nums1, vector<int>& nums2) { unordered_set<int> s(nums1.begin(),nums1.end()); vector<int> ret; for(auto x : nums2) if(s.erase(x)) ret.push_back(x); return ret; /*set<int> temp; for(auto num : nums1) temp.insert(num); set<int> result; for(auto num : nums2) if(temp.find(num)!=temp.end()&&result.find(num)==result.end()) result.insert(num); vector<int> ret(result.begin(),result.end()); return ret;*/ }};
0 0
- 349. Intersection of Two Arrays
- 349. Intersection of Two Arrays[][
- 349. Intersection of Two Arrays
- 349. Intersection of Two Arrays
- 349. Intersection of Two Arrays
- 349. Intersection of Two Arrays
- 349. Intersection of Two Arrays
- 349. Intersection of Two Arrays
- 349. Intersection of Two Arrays
- 349. Intersection of Two Arrays
- 349. Intersection of Two Arrays
- 349. Intersection of Two Arrays
- 349. Intersection of Two Arrays
- 349. Intersection of Two Arrays
- 349. Intersection of Two Arrays
- 349. Intersection of Two Arrays
- 349. Intersection of Two Arrays
- 349. Intersection of Two Arrays
- JS中日期格式化,加一天加一月等等
- Apache Kafka编程入门指南:Producer
- android 断言的 使用
- Hive 权限控制
- 杭州8岁女孩放歌G20峰会 女孩由张艺谋选定
- 349. Intersection of Two Arrays
- Angularjs 阻止默认事件
- 泛型五大约束
- Python_TCP编程
- cloudera manager下的hive权限配置
- 内存泄漏和溢出
- python基本语法汇编总结
- 常用的mac 终端命令
- 基于redis的分布式互斥锁