Description
Given two 0-indexed integer arrays nums1 and nums2, return a list answer of size 2 where answer[0] is distinct values in nums1 not in nums2, and answer[1] is distinct values in nums2 not in nums1.
Examples
Input:
nums1 = [1,2,3], nums2 = [2,4,6]Output:
[[1,3],[4,6]]Explanation:
Unique to each.
Input:
nums1 = [5,7,9,11], nums2 = [8,10,12,14]Output:
[[5,7,9,11],[8,10,12,14]]Explanation:
No elements are common between the arrays, so all elements from nums1 are unique to nums1, and all elements from nums2 are unique to nums2.
Input:
nums1 = [1,2,2,3,4], nums2 = [3,4,4,5,6,7]Output:
[[1,2],[5,6,7]]Explanation:
Elements 3 and 4 appear in both arrays, so they are excluded. Elements 1 and 2 are unique to nums1, while elements 5, 6, and 7 are unique to nums2. Only distinct elements are returned.
Constraints
- •
1 ≤ nums1.length, nums2.length ≤ 1000