# Leetcode no. 349

349. Intersection of Two Arrays

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.

public class Solution {
public int[] intersection(int[] nums1, int[] nums2) {
Set<Integer> set= new HashSet<>();
Set<Integer> resset= new HashSet<>();
for (int ele: nums1) {
}
for (int ele: nums2) {
}
int[] res= new int[resset.size()];
int i=0;
for (Integer ele: resset) {
res[i++]= ele;
}
return res;
}
}

#### leetcode 349. Intersection of Two Arrays（C语言）10

2017-09-22 21:15:33

#### Leetcode 349. Intersection of Two Arrays 解题报告 Python Java

2016-05-18 23:30:59

#### leetcode_349 Intersection of Two Arrays

2016-05-28 18:13:55

#### LeetCode 349. Intersection of Two Arrays 题解（C++）

2016-10-11 15:44:20

#### leetcode_349（找两个集合的交集）

2016-11-29 21:55:19

#### Leetcode刷题笔记_二分法部分

2017-06-24 15:03:57

#### leetcode 记录 349. Intersection of Two Arrays

2016-05-18 21:09:57

#### leetcode【217+219 Contains Duplicate I+II】【python】

2016-09-08 10:33:49

#### [leetcode] 349. Intersection of Two Arrays

2016-05-19 16:01:01

#### LeetCode #349

2016-08-08 10:11:24