본문 바로가기

Programmers/Level1

(66)
[카카오 인턴] 키패드 누르기 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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 class Solution { public String solution(int[] numbers, String hand) { String answer = ""; StringBuffer sb = new StringBuffer(); int left_row = 4, left_col = 1, right_row = 4, right_col = 3, next_row, next_col; in..
약수의 개수와 덧셈 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 class Solution { public int solution(int left, int right) { int answer = 0; int i, j, cnt = 0; for (i = left; i
신규 아이디 추천 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 class Solution { public String solution(String new_id) { String answer = ""; new_id = new_id.toLowerCase(); new_id = new_id.replaceAll("[\\~\\!\\@\\#\\$\\%\\^\\&\\*\\(\\)\\=\\+\\[\\{\\]\\}\\:\\?\\,\\\\/]", ""); new_id = new_id.replaceAll("[.]+", "."); new_id = new_id.replaceAll("^[.]|[.]$", ""); if (new_id.len..
모의고사 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 import java.util.ArrayList; import java.util.HashMap; class Solution { public int[] solution(int[] answers) { int[][] person = { { 1, 2, 3, 4, 5 }, { 2, 1, 2, 3, 2, 4, 2, 5 }, { 3, 3, 1, 1, 2, 2, 4, 4, 5, 5 } }; int[] answer = {}; int n, i, j, max; HashMap map = new HashMap(); ArrayList num = ne..
소수 만들기 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 class Solution { public int solution(int[] nums) { int answer = 0; int i, j, k, l, m; int s1 = 0, s2 = 0, s3 = 0; for (i = 0; i
K번째수 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 import java.util.ArrayList; import java.util.Collections; class Solution { public int[] solution(int[] array, int[][] commands) { int[] answer = {}; ArrayList tmpList = new ArrayList(); ArrayList ansList = new ArrayList(); for (int i = 0; i
체육복 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 import java.util.Arrays; import java.util.HashMap; class Solution { public int solution(int n, int[] lost, int[] reserve) { int answer = 0; HashMap map1 = new HashMap(); HashMap map2 = new HashMap(); for (int res : reserve) { map2.put(res, 1); } for (int lo : lost) { if (map2.getOrDe..
모든 레코드 조회하기 SELECT * from animal_ins order by animal_id;