programmers/pg_JAVA

문자열 배열 strlist가 매개변수로 주어집니다. strlist 각 원소의 길이를 담은 배열을 retrun하도록 solution 함수를 완성해주세요. class Solution { public int[] solution(String[] strlist) { int[] answer = new int[strlist.length]; for(int i=0;i
정수가 들어 있는 배열 num_list가 매개변수로 주어집니다. num_list의 원소의 순서를 거꾸로 뒤집은 배열을 return하도록 solution 함수를 완성해주세요. class Solution { public int[] solution(int[] num_list) { int[] answer = new int[num_list.length]; for(int i=0; i
첫 번째 분수의 분자와 분모를 뜻하는 numer1, denom1, 두 번째 분수의 분자와 분모를 뜻하는 numer2, denom2가 매개변수로 주어집니다. 두 분수를 더한 값을 기약 분수로 나타냈을 때 분자와 분모를 순서대로 담은 배열을 return 하도록 solution 함수를 완성해보세요. 풀이1) class Solution { public int[] solution(int numer1, int denom1, int numer2, int denom2) { int answer[] = new int[2]; //분모를 같게 해주기 위해 각각의 분자에 분모값을 곱하여 덧셈 int numer = numer1*denom2 + numer2*denom1; int denom = denom1*denom2; // 최소공..
아잠만_
'programmers/pg_JAVA' 카테고리의 글 목록 (12 Page)