You are viewing a single comment's thread. Return to all comments →
public static int migratoryBirds(List<Integer> arr) { return arr.stream() .collect(Collectors.groupingBy(Function.identity(), Collectors.counting())) .entrySet().stream() .sorted((a, b) -> (int) (b.getValue() - a.getValue())) .mapToInt(es -> es.getKey()) .findFirst() .getAsInt(); }
Seems like cookies are disabled on this browser, please enable them to open this website
Migratory Birds
You are viewing a single comment's thread. Return to all comments →