class Solution:
def intersection(self, nums1: List[int], nums2: List[int]) -> List[int]:
end=[]
for n1 in nums1:
if n1 in nums2 and n1 not in end:
end.append(n1)
return end
in和not in可以判断元素是否在数组里。