[LeetCode] 349. Intersection of Two Arrays
Python
class Solution:
def intersection(self, nums1: List[int], nums2: List[int]) -> List[int]:
answer = []
num1, num2 = set(nums1), set(nums2)
for i in set(num1):
if i in set(num2):
answer.append(i)
return answer
댓글남기기