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 which are not present in nums2, and answer[1] is a list of all distinct integers in nums2 which are not present in nums1. The integers in each list may be returned in any order.
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 which are not present in nums2, and answer[1] is a list of all distinct integers in nums2 which are not present in nums1. The integers in each list may be returned in any order.
Example 1:
Input: {"nums1":[1,2,3],"nums2":[2,4,6]}
Output: [[1,3],[4,6]]
Constraints:
1≤nums1.length,nums2.length≤1000
−1000≤nums1[i],nums2[i]≤1000
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"nums1":[1,2,3],"nums2":[2,4,6]}
Add nums1[0] = 1 to set1. Sets keep one copy of each value and answer "is x here?" in O(1).