You are viewing a single comment's thread. Return to all comments →
public static int migratoryBirds(List<Integer> arr) { Map<Integer,Integer> m=new HashMap<>(); for(int i: arr){ if(m.containsKey(i)){ m.put(i, m.get(i)+1); } else{ m.put(i, 1); } } int key=0; int value=0; for(int i:m.keySet()){ if(m.get(i)>value){ value=m.get(i); key=i; } } return key; }
}
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 →
}