文章作者:Tyan 博客:noahsnail.com | CSDN | 简书
class Solution:
def intersection(self, nums1, nums2):
result = set()
for x in nums1:
if x in nums2:
result.add(x)
return list(result)
class Solution:
def intersection(self, nums1, nums2):
result = set()
stat = {}
for x in nums1:
stat[x] = x
for x in nums2:
if x in stat:
result.add(x)
return list(result)
class Solution:
def intersection(self, nums1, nums2):
return list(set(nums1) & set(nums2))