매일코테 93

백준 12단계 no.4

문제에서 제시한 입력으로 출력은 알맞게 나오는데 틀렸다고 한다. 그 이유를 모름 public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[n]; for (int i = 0; i < n; i++) { arr[i] = sc.nextInt(); } int m = sc.nextInt(); Map map = new LinkedHashMap(); for(int i = 0; i < m; i++) { map.put(sc.nextInt(), 0); } for (int j : arr) { if (map.containsKey(j)) { map.put(j, map.get..

백준 11단계 no.3

계수 정렬 참고 : https://st-lab.tistory.com/104 자바 [JAVA] - 카운팅 정렬 (Counting Sort / 계수 정렬) [정렬 알고리즘 모음] 더보기 1. 계수 정렬 (Counting Sort) - [현재 페이지] 2. 선택 정렬 (Selection Sort) 3. 삽입 정렬 (Insertion Sort) 4. 거품 정렬 (Bubble Sort) 5. 셸 정렬 (Shell Sort) 6. 힙 정렬 (H.. st-lab.tistory.com import java.io.*; import java.util.*; public class Main { static int max (int[] arr) { int max = arr[0]; for (int j : arr) { if (j >..

매일코테 2022.07.27