You are viewing a single comment's thread. Return to all comments →
Save time and space I believe
int result = 0; Map count = new HashMap<>();
for(int num : a) { if(count.containsKey(num)) { count.remove(num); } else { count.put(num, 0); } } for(Map.Entry entry : count.entrySet()) { result = entry.getKey(); }
return result;
Seems like cookies are disabled on this browser, please enable them to open this website
Lonely Integer
You are viewing a single comment's thread. Return to all comments →
Save time and space I believe
int result = 0; Map count = new HashMap<>();
for(int num : a) { if(count.containsKey(num)) { count.remove(num); } else { count.put(num, 0); } } for(Map.Entry entry : count.entrySet()) { result = entry.getKey(); }