- class Solution(object):
- def intersect(self, nums1, nums2):
- """
- :type nums1: List[int]
- :type nums2: List[int]
- :rtype: List[int]
- """
- res = []
- num = {}
- for c in nums1:
- num[c] = num[c]+1 if c in num else 1
- for j in nums2:
- if j in num and num[j]>0:
- res.append(j)
- num[j]-=1
- return res
350. Intersection of Two Arrays II(python)
猜你喜欢
转载自blog.csdn.net/weixin_41362649/article/details/79975000
今日推荐
周排行