thiagowfx's avatar

Β¬ just serendipity πŸ€ (not just serendipity)

LeetCode #2215: Find the Difference of Two Arrays

β€’ 32 words β€’ 1 min

LeetCode #2215: Find the Difference of Two Arrays:

python
class Solution:
    def findDifference(self, nums1: List[int], nums2: List[int]) -> List[List[int]]:
        s1 = set(nums1)
        s2 = set(nums2)

        return [list(s1 - s2), list(s2 - s1)]