반응형
leetcode.com/problems/intersection-of-two-arrays/
class Solution:
def intersection(self, nums1: List[int], nums2: List[int]) -> List[int]:
a=list(set(nums1))
b=list(set(nums2))
dct = collections.Counter(a+b)
ans =[]
for key in dct:
if dct[key]>1:
ans.append(key)
return ans
댓글