leetcode 349 Intersection of Two Arrays C++
来源:互联网 发布:maven 指定java版本 编辑:程序博客网 时间:2024/06/06 09:01
这题利用了set里面不能放重复元素的特性来解决
class Solution {public: vector<int> intersection(vector<int>& nums1, vector<int>& nums2) { set<int> s; vector<int> nums3; for (int i = 0;i<nums1.size();i++){ s.insert(nums1[i]); } for (int i = 0;i<nums2.size();i++){ if(s.find(nums2[i]) != s.end()){ s.erase(nums2[i]); nums3.push_back(nums2[i]); } } return nums3; }};
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
- 模板2
- There is no Action mapped for namespace [/] and action name [login] associate解决办法 .
- Ubuntu下开启Mysql远程访问的方法
- Android动画效果(二) 仿QQ点赞动画
- memory_target和/dev/shm的关系
- leetcode 349 Intersection of Two Arrays C++
- 【1139】数据结构上机测试2-2:单链表操作B
- java.lang.NoClassDefFoundError: Lorg/apache/log4j/Logger报错
- S-01. 域服务安装与配置 ❀ Windows Server 2008 R2
- Android——TabLayout实现选项卡
- Android 定制开机自启动应用
- Android自助餐之自定义控件(一)从layout自定义控件
- 11. php的错误和异常处理(一)
- bootstrap多文件预览上传