1
2
3
4
5
6
7
|
class Solution:
def intersection(self, nums1: List[int], nums2: List[int]) -> List[int]:
ans=[]
for i in nums1:
if i in nums2: ans.append(i)
ans=list(set(ans))
return ans
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
leetcode 1991. Find the Middle Index in Array (0) | 2022.03.24 |
---|---|
leetcode 1619. Mean of Array After Removing Some Elements (0) | 2022.03.23 |
leetcode 2085. Count Common Words With One Occurrence (0) | 2022.03.22 |
leetcode 852. Peak Index in a Mountain Array (0) | 2022.03.22 |
leetcode 1380. Lucky Numbers in a Matrix (0) | 2022.03.22 |
댓글