코딩테스트
-
JAVA 코딩테스트 문제 10 - 숨어있는 숫자의 덧셈(1)카테고리 없음 2024. 6. 18. 15:42
프로그래머스 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 - 가위바위보프로그래밍/JAVA 2024. 6. 16. 19:04
프로그래머스 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 코딩테스트 문제 7프로그래밍/JAVA 2024. 4. 27. 16:02
프로그래머스 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..