function solution(A, B) {
let answer = 0;
const sortA = A.sort((a, b) => b - a)
const sortB = B.sort((a, b) => b - a)
let indexA=0, indexB=0
while(indexA < sortA.length && indexB < sortB.length){
if(sortA[indexA] < sortB[indexB]){
answer++;
indexA++;
indexB++;
}else{
indexA++;
}
}
return answer;
}
이중 for문 대신 while문 쓰기