Beakjoon&프로그래머스/Java457 [프로그래머스/Java] 카드 뭉치 -Codeclass Solution { public String solution(String[] cards1, String[] cards2, String[] goal) { int idx1 = 0, idx2 = 0; boolean flag = true; for (String el : goal) { if (idx1 2025. 2. 26. [프로그래머스/Java] [1차] 비밀지도 -Codeclass Solution { public String[] solution(int n, int[] arr1, int[] arr2) { String[] answer = new String[n]; String line1; String line2; for (int i = 0; i | 연산을 사용하는 것과 0추가 부분도 %${n}s를 사용하면 쉽게 풀 수 있는데 잊고 있었습니다. 2025. 2. 26. [프로그래머스/Java] 명예의 전당 (1) -Codeimport java.util.*;class Solution { public int[] solution(int k, int[] score) { List honor = new ArrayList(); List answer = new ArrayList(); for (int p : score) { honor.add(p); Collections.sort(honor); if (honor.size() > k) { honor.remove(0); } answer.add(honor.get(0)); } return answer.stre.. 2025. 2. 26. [프로그래머스/Java] 콜라 문제 -Codeclass Solution { public int solution(int a, int b, int n) { int answer = 0; int temp; while (n >= a) { temp = n / a * b; answer += temp; n = temp + n % a; } return answer; }} 2025. 2. 26. [프로그래머스/Java] 문자열 내 마음대로 정렬하기 -Codeimport java.util.*;class Solution { public String[] solution(String[] strings, int n) { return Arrays.stream(strings).sorted( Comparator.comparing((String el) -> el.charAt(n)) .thenComparing(Comparator.naturalOrder()) ).toArray(String[]::new); }} 2025. 2. 26. [프로그래머스/Java] 푸드 파이트 대회 -Codeclass Solution { public String solution(int[] food) { StringBuilder answer = new StringBuilder(); int water = food[0] + 1; for (int i = 1; i 2025. 2. 26. 이전 1 ··· 3 4 5 6 7 8 9 ··· 77 다음