-> 자세한 내용 보러가기
import java.util.*;
class Solution {
public int[] solution(int[] lottos, int[] win_nums) {
int[] answer = new int[2]; //최고순위와 최저 순위를 return
int zero = 0; //알아볼 수 없는 번호 -> 다 맞으면 최고 다 틀리면 최저
int get = 0; //맞춘 번호
Set<Integer> set = new HashSet<>();
for(int num : win_nums){
set.add(num);
}
for(int lotto : lottos){
if(lotto == 0){
zero++;
}else if(set.contains(lotto)){
get++;
}
}
//최고 순위는 zero가 다 맞아야함
answer[0] = 7 - Math.max((zero + get), 1);
answer[1] = 7 - Math.max(get, 1);
return answer;
}
}