import java.util.*;
class Solution {
public int[] solution(int[] answers) {
int[] supo1 = {1,2,3,4,5};
int[] supo2 = {2,1,2,3,2,4,2,5};
int[] supo3 = {3,3,1,1,2,2,4,4,5,5};
int count1=0;
int count2=0;
int count3=0;
//supo1
for(int i=0; i<answers.length; i++){
if(answers[i]==supo1[i%supo1.length]) count1++;
}
//supo2
for(int j=0; j<answers.length; j++){
if(answers[j]==supo2[j%supo2.length]) count2++;
}
//supo3
for(int k=0; k<answers.length; k++){
if(answers[k]==supo3[k%supo3.length]) count3++;
}
//최대개수
int max = Math.max(Math.max(count1, count2),count3);
//최대값과 수포자1~3의 최대값이 같을경우 각각 1, 2, 3 List에 추가
List<Integer> arr = new ArrayList<>();
if(max==count1) arr.add(1);
if(max==count2) arr.add(2);
if(max==count3) arr.add(3);
int answer[] = new int[arr.size()];
//배열에 list값 추가
for(int i=0; i<answer.length; i++){
answer[i] = arr.get(i);
}
return answer;
}
}