본문 바로가기

728x90
반응형
SMALL

코딩테스트

(10)
JAVA 코딩테스트 문제 10 - 숨어있는 숫자의 덧셈(1) 프로그래머스 lv0 - 숨어있는 숫자의 덧셈(1)blic class IntJudge { public static int solution(String my_string) { int answer =0; String[] a = my_string.split(""); for(String i: a) { try { answer += Integer.parseInt(i); }catch(NumberFormatException e) { e.getStackTrace(); } }return answer;}
JAVA 코딩테스트 문제 9 - 가위바위보 프로그래머스 lv0 - 가위바위보public static String solution(String rsp) { String answer = ""; String[] a=rsp.split(""); for(int i =0;ia.length;i++) {if(a[i].equals("0")) answer.concat("5"); else if(a[i].equals("2"))answer.concat("0"); else answer.concat("2"); } return answer; }
java 코딩테스트 문제 8 프로그래머스 level 0 - 개미 군단 class Solution { public int solution(int hp) { int general =5; int soldier = 3; int labor =1; int mod=0; int answer = 0; answer = hp/general; mod = hp%general; if(mod!=0) { if(soldier
JAVA 코딩테스트 문제 7 프로그래머스 level 0 배열 순서 바꾸기class Solution {     public int[] solution(int[] num_list) {                  for(int i=0;i            int temp = num_list[i];             num_list[i] = num_list[num_list.length-i-1];             num_list[num_list.length-i-1] = temp;          }         int[] answer = new int[num_list.length];         for(int i=0;i            answer[i] = num_list[i];         }         retu..
JAVA 코딩테스트 문제 6 프로그래머스 코딩테스트 문제 피자 나눠 먹기 2 level 0class Solution {     public int solution(int slice, int n) {         int answer = 0;         if(2            if(1                if(n%slice == 0){                     answer = n/slice;                 }                 else{                     answer = n/slice+1;                 }                                }                      }         return answer;   ..
JAVA 코딩테스트 문제 5 프로그래머스 코딩테스트 문제 level0 피자 나눠먹기 1 ]class Solution { public int solution(int n) { int answer = 0; if(1
JAVA 코딩테스트 문제 4 프로그래머스 중앙값 구하기 level 0 import java.util.Arrays; class Solution { public int solution(int[] array) { int answer = 0; int i = array.length/2; if(0
JAVA 코딩테스트 문제 3 프로그래머스 배열의 평균값 구하기 level 0 class Solution { public double solution(int[] numbers) { double answer = 0; int sum = 0; if(0

728x90
반응형
LIST