leetcode——349.数组的交集

class Solution:
    def intersection(self, nums1, nums2):
        set1=set(nums1)
        set2=set(nums2)
        num=[]
        for i in set1:
            if i in set2:
                num.append(i)
        return num
执行用时 :76 ms, 在所有 Python3 提交中击败了55.32%的用户
内存消耗 :13.9 MB, 在所有 Python3 提交中击败了5.02%的用户
 
                             ——2019.10.7
posted @ 2019-10-07 16:26  欣姐姐  阅读(139)  评论(0编辑  收藏  举报