LeetCode : Intersection of Two Arrays
来源:互联网 发布:js点击按钮跳指定div 编辑:程序博客网 时间:2024/06/08 17:12
Given two arrays, write a function to compute their intersection.
Example:
Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].
Note:
Each element in the result must be unique.
The result can be in any order.
class Solution {public: vector<int> intersection(vector<int>& nums1, vector<int>& nums2) { vector<int>result; for(int i=0;i<nums1.size();++i) { if(find(nums2.begin(),nums2.end(),nums1[i])!=nums2.end()) { if(find(result.begin(),result.end(),nums1[i])==result.end()) { result.push_back(nums1[i]); } } } return result; }};
0 0
- [LeetCode] Intersection of Two Arrays
- LeetCode Intersection of Two Arrays
- LeetCode:Intersection of Two Arrays
- 【leetcode】Intersection of Two Arrays
- leetcode Intersection of Two Arrays
- 【leetcode】Intersection of Two Arrays
- leetcode:Intersection of Two Arrays
- [Leetcode]Intersection of Two Arrays
- LeetCode:Intersection of Two Arrays
- LeetCode: Intersection of Two Arrays
- leetcode ----Intersection of Two Arrays
- LeetCode Intersection of Two Arrays
- [Leetcode] Intersection of Two Arrays
- LEETCODE--Intersection of Two Arrays
- LeetCode : Intersection of Two Arrays
- leetcode---Intersection of Two Arrays
- leetCode---Intersection of Two Arrays
- leetcode[Intersection of Two Arrays]
- MySQL中索引的设计
- ssl协商以及秘钥交换
- C# 进程管理器
- 2017.02.24 Javascript 面向对象编程2--继承
- android面试热点:webview使用及与js数据交互
- LeetCode : Intersection of Two Arrays
- Python自学-第16次作业
- android studio上传项目到github
- input输入框回车事件响应
- 欢迎使用CSDN-markdown编辑器
- 如何保证kafka 的消息机制
- FreeRTOS操作系统移植
- 继承
- 建立一个文件,在文件中输入学生信息,查找文件,输出学生的信息