You are viewing a single comment's thread. Return to all comments →
Java
public static int sockMerchant(int n, List<Integer> ar) { Set<Integer> dict = new HashSet<Integer>(); int count = 0; for(Integer num : ar){ if(dict.contains(num)){ count++; dict.remove(num); } else{ dict.add(num); } } return count; }
Seems like cookies are disabled on this browser, please enable them to open this website
Sales by Match
You are viewing a single comment's thread. Return to all comments →
Java