LeetCode #2215: Find the Difference of Two Arrays
β’ 32 words β’ 1 min
LeetCode #2215: Find the Difference of Two Arrays:
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)]
Related Posts
LeetCode #2965: Find Missing and Repeated Values:
Two sets:
python class Solution: def findMissingAndRepeatedValues(self, grid: List[List[int]]) -> β¦
Jan 08, 2026
LeetCode #652: Find Duplicate Subtrees:
Original, 119 / 175 testcases passed:
python from collections import defaultdict # Definition for a binary β¦
Jan 07, 2026
Previously, previously, previously, previously, previously.
Thiago Perrotta