class Solution {
public List<List<Integer>> findDifference(int[] nums1, int[] nums2) {
List<List<Integer>> res = new ArrayList<>();
res.add(new ArrayList<>());
res.add(new ArrayList<>());
Set<Integer> nums1Set = new HashSet();
Set<Integer> nums2Set = new HashSet();
for (int num : nums1) {
nums1Set.add(num);
}
for (int num : nums2) {
nums2Set.add(num);
}
for (int num : nums1Set) {
if (!nums2Set.contains(num)) res.get(0).add(num);
}
for (int num : nums2Set) {
if (!nums1Set.contains(num)) res.get(1).add(num);
}
return res;
}
}