본문 바로가기
python-algorithm

leetcode 349. Intersection of Two Arrays

by 무적김두칠 2022. 3. 23.

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
반응형

댓글