Practice Find the Difference of Two Arrays
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Return two lists: answer[0] contains the distinct values found in nums1 but absent from nums2, and answer[1] contains the distinct values found in nums2 but absent from nums1. Values within either list may appear in any order.
Source: Find the Difference of Two Arrays on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
nums1 = [1,2,3], nums2 = [2,4,6]
Output
[[1,3],[4,6]]
# Example 2
Input
nums1 = [1,2,3,3], nums2 = [1,1,2,2]
Output
[[3],[]]
Constraints
1 <= nums1.length, nums2.length <= 1000
-1000 <= nums1[i], nums2[i] <= 1000
Related LeetCode Problems
Practice more problems similar to Find the Difference of Two Arrays.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.