https://leetcode.com/problems/sum-of-unique-elements/description/

class Solution {
public int sumOfUnique(int[] nums) {
Map<Integer, Integer> map = new HashMap<>();
int sum = 0;
for(int n : nums) {
map.put(n, map.getOrDefault(n,0) + 1);
}
for(int key : map.keySet()) {
int value = map.get(key);
if(value == 1) {
sum+=key;
}
}
return sum;
}
}