public int solution(int[] A, int[] B) {
Arrays.sort(A);
Arrays.sort(B);
int answer = 0;
int length = A.length;
for (int i = 0; i < length; i++) {
answer += A[i] * B[length - i - 1];
}
return answer;
}
출처:https://school.programmers.co.kr/learn/courses/30/lessons/12941