프로그래머스 (1) 썸네일형 리스트형 2022 KAKAO BLIND RECRUITMENT - 신고 결과 받기(Java) Hash를 사용하는 문제였다. LinkedHashMap, HashSet을 사용해 풀었다. int[] answer = {}; answer = new int[id_list.length]; HashMap reportLog = new HashMap(); Arrays.stream(id_list).forEach(id -> reportLog.put(id, new HashSet())); 우선, answer를 초기화하고, 신고 기록을 담을 HashMap을 만들었다. reportLog는 key로 id를 가지고, value로 해당 id를 신고한 id들을 가진다. value를 HashSet으로 한 이유는, 중복 신고가 없기 때문이다. Arrays.stream(report).forEach(log -> { reportLog.ge.. 이전 1 다음