import java.util.*;
class Solution {
public int solution(int[] array) {
int maxCount = 0;
int answer = 0;
Map<Integer, Integer> map = new HashMap<>();
for(int number : array){
int count = map.getOrDefault(number, 0) + 1;
if(count > maxCount){
maxCount = count;
answer = number;
}
else if(count == maxCount){
answer = -1;
}
map.put(number, count);
}
return answer;
}
}
이걸 어떻게 해쉬맵을 쓰지..