Chapter 04. HashMap, TreeSet (해쉬, 정렬지원 Set)
1. 학급 회장 (Hash) import java.util.*; public class Main { public char solution(int n, String s){ char answer = ' '; HashMap map = new HashMap(); for(char x : s.toCharArray()){ map.put(x, map.getOrDefault(x, 0) + 1); // x의 value가 있으면 가져오고 없으면 0리턴 } int max = Integer.MIN_VALUE; for(char key : map.keySet() ){ // System.out.println(x + " " + map.get(x));// 각각의 key를 출력 if(map.get(key) > max){ max = map..