programmers_최솟값 만들기_java
2023. 2. 27. 11:09ㆍAlgorithm/Programmers
728x90
https://school.programmers.co.kr/learn/courses/30/lessons/12941
import java.util.*;
class Solution
{
public int solution(int []A, int []B)
{
int answer = 0;
int size = A.length;
Arrays.sort(A);
Arrays.sort(B);
int sum = 0;
for(int i = 0; i< size; i++){
sum+= A[i] * B[size-1-i];
}
answer = sum;
return answer;
}
}
'Algorithm > Programmers' 카테고리의 다른 글
programmers_단어 변환_java (0) | 2023.02.27 |
---|---|
programmers_네트워크_java (0) | 2023.02.27 |
programmers_올바른 괄호_java (0) | 2023.02.27 |
programmers_JadenCase 문자열 만들기_java (0) | 2023.02.27 |
programmers_최댓값과 최솟값_java (0) | 2023.02.24 |