class Solution {
public int[] singleNumbers(int[] nums) {
Set<Integer> set = new HashSet<>();
int n = nums.length;
for(int i=0;i<n;i++){
if(set.contains(nums[i])){
set.remove(nums[i]);
}else{
set.add(nums[i]);
}
}
Iterator<Integer> it = set.iterator();
return new int[]{it.next(),it.next()};
}
}