Difference of Two Arrays
Return a list of two lists:
- first: the distinct values that appear in
nums1but not innums2 - second: the distinct values that appear in
nums2but not innums1
Sort each inner list in increasing order.
Example 1
nums1 [1,2,3,3]
nums2 [2,4,6]
returns [[1,3],[4,6]]
nums1 alone has 1 and 3; nums2 alone has 4 and 6.
Constraints
0 <= len(nums1), len(nums2) <= 30-20 <= nums[i] <= 20
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More Hash maps problems
- First Repeated WordBeginner
- Is IsogramBeginner
- Jewels and StonesBeginner
- Keep First of Each LetterBeginner
- Letter Count TableBeginner
- Matching Sock PairsBeginner
- Translate With a GlossaryBeginner
- Unfilled OrdersBeginner