본문 바로가기
알고리즘/leetcode

2215. Find the Difference of Two Arrays

by 1.5볼트 2023. 5. 3.
728x90

 

두개의 리스트가 주어지면 교집합을 제거하고 남은 리스트를 리턴한다

class Solution:
    def findDifference(self, nums1: List[int], nums2: List[int]) -> List[List[int]]:
        return [list(set(nums1)-set(nums2)),list(set(nums2)-set(nums1))]

'알고리즘 > leetcode' 카테고리의 다른 글

54. Spiral Matrix - python  (0) 2023.05.09
1572. Matrix Diagonal Sum - python  (0) 2023.05.08
1822. Sign of the Product of an Array  (0) 2023.05.02
183. Customers Who Never Order  (0) 2023.04.30
178. Rank Scores  (0) 2023.04.29

댓글