Skip to content

#2215 - Find the Difference of Two Arrays

EasyHash Map / Set
Open on LeetCode

Given two 0-indexed integer arrays nums1 and nums2, return a list answer of size 2 where:

  • answer[0] is a list of all distinct integers in nums1 that are not in nums2.
  • answer[1] is a list of all distinct integers in nums2 that are not in nums1.

The integers in each list may be returned in any order.

InputOutput
nums1 = [1,2,3], nums2 = [2,4,6][[1,3],[4,6]]
nums1 = [1,2,3,3], nums2 = [1,1,2,2][[3],[]]

Released under the MIT License.