my python

  • 0
    def intersect(self, nums1, nums2):
            :type nums1: List[int]
            :type nums2: List[int]
            :rtype: List[int]
            dic1,dic2 = {},{}
            for num in nums1:
                dic1[num] = dic1.get(num,0)+1
            for num in nums2:
                dic2[num] = dic2.get(num,0)+1
            res = []
            for num in dic1:
                if num in dic2:
                    for i in range(min(dic1[num],dic2[num])):
            return res

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.