Easy
,Array
,Hash Table
2215. Find the Difference of Two Arrays
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
.answer[1]
is a list of all distinct integers in nums2
which are not present in nums1
.Note that the integers in the lists may be returned in any order.
Example 1:
Example 2:
Constraints:
nums1.length
, nums2.length
<= 1000nums1[i]
, nums2[i]
<= 1000SheepWed, May 3, 2023
慚愧,跟我弟學習了,本來用set1去刪set2然後再用set2刪set1,不止要做兩遍還要多建一個set根本87
MarsgoatWed, May 3, 2023
Ron ChenWed, May 3, 2023
JimWed, May 3, 2023
只能醜醜寫的我
Ron ChenWed, May 3, 2023
解答區看到的 Java Stream API 用法,太猛了