본문 바로가기

CodingTest46

코딩테스트 입문 - Day 12 모음 제거class Solution { public String solution(String my_string) { return my_string .replace("a", "") .replace("e", "") .replace("i", "") .replace("o", "") .replace("u", ""); }}문자열 정렬하기import java.util.Arrays;class Solution { public static int[] solution(String my_string) { String[] arr = my_string.replaceAll("[a-zA-Z]", "").split(""); int[]answer = new int[arr.length]; for(int.. 2025. 4. 20.
코딩테스트 입문 - Day 11 주사위의 개수class Solution { public int solution(int[] box, int n) { int a = box[0] / n; int b = box[1] / n; int c = box[2] / n; return a * b * c; }}합성 수 찾기import java.util.*;class Solution { public int solution(int n) { int answer = 0; ArrayList arr = new ArrayList(); for(int i = 2; i n){ break; } .. 2025. 4. 20.
코딩테스트 입문 - Day 10 점의 위치 구하기class Solution { public int solution(int[] dot) { if(dot[0] > 0 && dot[1] > 0){ return 1; }else if(dot[0] 0){ return 2; }else if(dot[0] 2차원으로 만들기class Solution { public int[][] solution(int[] num_list, int n) { int[][] answer = new int[num_list.length / n][n]; for (int i = 0; i 공 던지기class Solution { public int solution(int[] numbers.. 2025. 4. 20.
코딩테스트 입문 - Day 9 개미 군단class Solution { public int solution(int hp) { int sum = 0; for(int i = 5; i > 0; i -= 2){ sum += hp/i; hp %= i; } return sum; }}모스 부호 (1)import java.util.HashMap;class Solution { static String[] morse = { ".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.", .. 2025. 4. 20.
프로그래머스 - 특수문자 출력하기 문제 설명다음과 같이 출력하도록 코드를 작성해 주세요.출력 예시!@#$%^&*(\\'"?:;코드import java.util.Scanner;public class Solution { public static void main(String[] args) { System.out.print("!@#$%^&*(\\\\'\\"?:;"); }} 2025. 4. 12.
코딩테스트 입문 - Day 8 배열 자르기class Solution { public int[] solution(int[] numbers, int num1, int num2) { int[] answer = new int[num2 - num1 + 1]; for(int i = 0; i외계 행성의 나이class Solution { public String solution(int age) { String sAge = String.valueOf(age); StringBuilder sb = new StringBuilder(); for(int i = 0; i진료 순서 정하기import java.util.Arrays;class Solution { public int.. 2025. 4. 12.
728x90
반응형