class Solution {
public List<List<Integer>> findDifference(int[] nums1, int[] nums2) {
List<Integer> diff1 = new LinkedList<>(), diff2 = new LinkedList<>();
Set<Integer> set1 = new HashSet<>(), set2 = new HashSet<>();
for (int num: nums1) set1.add(num);
for (int num: nums2) set2.add(num);
for (int num: set1) {
if (set2.contains(num) == false) diff1.add(num);
}
for (int num: set2) {
if (set1.contains(num) == false) diff2.add(num);
}
List<List<Integer>> ans = new LinkedList<>();
ans.add(diff1);
ans.add(diff2);
return ans;
}
}