349. Intersection of Two Arrays

class Solution(object):
def intersection(self, nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: List[int]
"""
res=[]
for i in set(nums1):
if i in set(nums2):
res.append(i)
return res


class Solution(object):
def intersection(self, nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: List[int]
"""
return list(set(nums1).intersection(nums2))

class Solution(object):    def intersection(self, nums1, nums2):        """        :type nums1: List[int]        :type nums2: List[int]        :rtype: List[int]        """        return list(set(nums1).intersection(nums2))

posted @ 2018-08-15 02:26  ffeng0312  阅读(126)  评论(1)    收藏  举报