leetcode 350. Intersection of Two Arrays II
来源:互联网 发布:java web开发教程pdf 编辑:程序博客网 时间:2024/06/13 12:03
class Solution {public: vector<int> intersect(vector<int>& nums1, vector<int>& nums2) { sort(nums1.begin(),nums1.end()); sort(nums2.begin(),nums2.end()); int a = 0,b = 0; vector<int> ans; while(a < nums1.size() && b < nums2.size()){ if(nums1[a] == nums2[b]){ ans.push_back(nums1[a]); a++,b++; } else if(nums1[a] > nums2[b]) b++; else a++; } return ans; }};
0 0
- LeetCode 350. Intersection of Two Arrays II
- leetcode.350. Intersection of Two Arrays II
- [leetcode] 350. Intersection of Two Arrays II
- Leetcode 350. Intersection of Two Arrays II
- leetcode 350. Intersection of Two Arrays II
- Leetcode 350. Intersection of Two Arrays II
- [leetcode] 350. Intersection of Two Arrays II
- leetcode 350. Intersection of Two Arrays II
- 【leetcode】350. Intersection of Two Arrays II
- [Leetcode] 350. Intersection of Two Arrays II
- 【leetcode】350. Intersection of Two Arrays II
- LeetCode 350. Intersection of Two Arrays II
- LeetCode - 350. Intersection of Two Arrays II
- LeetCode 350. Intersection of Two Arrays II
- leetcode 350. Intersection of Two Arrays II
- leetcode-350. Intersection of Two Arrays II
- leetcode 350. Intersection of Two Arrays II
- [leetcode]350. Intersection of Two Arrays II
- Django学习计划--模型使用
- C++ this指针
- Java对象之死
- Qt Charts入门指南
- FORMS进阶之——LOV式手电筒查询
- leetcode 350. Intersection of Two Arrays II
- SGI-STL内存池实现及简单使用
- 2504 又见GCD
- UILabel文字添加删除线
- 大数据系列修炼-Scala课程17
- 数组与指针的定义与声明
- 关于ssm框架整合报错:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
- FORMS进阶之——增加按钮并响应执行数据库包存储过程
- Spring AOP 知识点 & 实现机制