#-*- coding: UTF-8 -*-
#求两个集合的交集
class Solution(object):
def intersection(self, nums1, nums2):
resultList=list(set(nums1).intersection(set(nums2)))
return resultList
sol=Solution()
print sol.intersection(nums1=[1, 2, 2, 1], nums2=[2,2])
相关文章
- LeetCode Intersection of Two Linked Lists (找交叉点)
- 349. Intersection of Two Arrays
- (LeetCode 160)Intersection of Two Linked Lists
- Leetcode 160. Intersection of two linked lists
- leetcode217-Intersection of Two Arrays
- 一起刷LeetCode4-Median of Two Sorted Arrays
- [LeetCode] 349 Intersection of Two Arrays && 350 Intersection of Two Arrays II
- LeetCode算法题-Intersection of Two Linked Lists(Java实现)
- Median of Two Sorted Arrays-----LeetCode
- C#LeetCode刷题之#4-两个排序数组的中位数(Median of Two Sorted Arrays)