Leetcode #349 Intersection of Two Arrays
2017-03-09 23:39
162 查看
Description
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.
Explain
python写真的太简洁Code
class Solution(object): def intersection(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: List[int] """ import collections return list(set(collections.Counter(nums1) & collections.Counter(nums2)))
相关文章推荐
- leetcode 349 Intersection of Two Arrays
- LEETCODE--Intersection of Two Arrays II
- Intersection of Two Arrays II
- LeetCode--No.350--Intersection of Two Arrays II
- Intersection of Two Arrays
- LeetCode-350 Intersection of Two Arrays II
- leetcode_c++:哈希:intersection of Two Arrays(349)
- Intersection of Two Arrays
- leetcode---Intersection of Two Arrays
- Python [Leetcode 350]Intersection of Two Arrays II
- 【leetcode76】Intersection of Two Arrays II
- Intersection of Two Arrays 两数组的交
- Leetcode_350_Intersection of Two Arrays II
- [LeetCode]Intersection of Two Arrays II(Java)
- [leetcode][350] Intersection of Two Arrays II
- Leetcode 349 Intersection of Two Arrays
- LeetCode Intersection of Two Arrays
- leetcode 350 Intersection of two arrays II
- [LeetCode]349 Intersection of Two Arrays
- [Leetcode] Intersection of Two Arrays II