Programmers/Java(14)
-
추억 점수
문제 설명 답12345678910111213141516171819202122232425import java.util.*; class Solution { public int[] solution(String[] name, int[] yearning, String[][] photo) { int[] result = new int[photo.length]; HashMapString, Integer> map = new HashMapString, Integer>(); for(int i=0; iname.length; i++) { map.put(name[i], yearning[i]); } f..
2024.08.27 -
크레인 인형뽑기 게임
문제 결과 풀이 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 import java.util.*; class Solution { public int solution(int[][] board, int[] moves) { int answer = 0; Stack stack = new Stack(); for(int j=0; j
2023.09.04 -
마법의 엘리베이터
문제 결과 풀이 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 class Solution { public int solution(int storey) { int div =0; int answer = 0; //현재 층이 0층이 될때까지 반복한다. while(storey != 0) { //1의 자리 div = storey % 10; //1의 자리가 5보다 크면 위부터 올라감 if(div > 5) { answer += 10-div; storey += 10-div; //1의 자리가 5라면 그 앞자리가 5 이상이지 미만인지 알아야 함 }else i..
2023.08.04 -
전국 대회 선발 고사
문제 결과 풀이 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 import java.util.ArrayList; import java.util.Arrays; class Solution { public int solution(int[] rank, boolean[] attendance) { ArrayList array = new ArrayList(); for(int i=0; i
2023.05.24 -
x 사이의 개수
문제 결과 풀이 1. 처음 작성한 코드 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 import java.util.ArrayList; class Solution { public ArrayList solution(String myString) { String[] s = myString.split("x"); ArrayList ii = new ArrayList(); for(int i=0; i
2023.05.17 -
qr code
문제 결과 풀이 1 2 3 4 5 6 7 8 9 10 11 12 13 class Solution { public String solution(int q, int r, String code) { StringBuilder sb = new StringBuilder(); for(int i=0; i
2023.05.13