from collections import defaultdict classSolution: defintersect(self, nums1: List[int], nums2: List[int]) -> List[int]: dic, ans = defaultdict(int), list() for i in nums1: dic[i] += 1 for i in nums2: if dic[i] != 0: ans.append(i) dic[i] -= 1 return ans