목록프로그래머스 (35)
밍쎄의 코딩공간

문제 class Solution { public long solution(long k, long d) { long answer = 0; for(long x = 0; x
import java.util.*; class Solution { public int solution(int[] people, int limit) { int answer = 0; Arrays.sort(people); int index = 0; for (int i = people.length - 1; i >= index; i--) { if (people[i] + people[index]
import java.util.HashMap; class Solution { public int[] solution(String[] keymap, String[] targets) { HashMap hm = new HashMap(); int[] ret = new int[targets.length]; for(String key : keymap) { for(int i=0 ; i
소싯적에 우리는 한컴타자를 했다. ㅎㅎ 그때 광물캐기라는 코너 속 코너 게임이 있엇는디,,, 정감가드라요..~ import java.util.*; class Solution { public int solution(int[] picks, String[] minerals) { int answer = 0; int num = picks[0] + picks[1] + picks[2]; int[][] section = new int[minerals.length / 5 + 1][3]; int i, pick; for(i = 0; i 0; i++) { switch(minerals[i].charAt(0)) { case 'd': section[i / 5][0] += 1; sec..

1. 문자열의 모든 문자에 대해 반복 A. 문자가 공백 문자일 경우 - 그대로 이어 붙이기 - 다음 등장하는 알파벳은 대문자 B. 공백 문자가 아닌 경우 - 대, 소문자 변환하여 이어 붙이기 - 다음 등장하는 알파벳의 대, 소문자는 현재 변환하는 문자와 반대 class Solution { public String solution(String s) { StringBuilder builder = new StringBuilder(); boolean toUpper = true; for (char c : s.toCharArray()){ if(!Character.isAlphabetic(c)){ builder.append(c); toUpper = true; }else{ if(toUpper){ builder.appen..
그래프 탐색 문제이다. 푸는 과정 속에 어려움을 겪어 밑에 분의 코드를 참고하였다. // 2차원 배열을 벗어나지 않으면서 X가 아니면 재귀 호출 이 부분을 구현하는 것이 매우 미흡하였다. import java.util.*; class Solution { static int startX; static int startY; public int[] solution(String[] park, String[] routes) { int[] answer = new int[2]; // 동서남북 이동할 좌표 map에 삽입 Map map = new HashMap(); map.put("N", new int[]{-1, 0}); map.put("E", new int[]{0, 1}); map.put("S", new int[]{1..