모의고사 java
-
Level1) 모의고사PS/programmers 2020. 9. 8. 12:43
import java.util.ArrayList; import java.util.Arrays; class Solution { public static int[] solution(int[] answers) { int[] student1 = {1, 2, 3, 4, 5}; int[] student2 = {2, 1, 2, 3, 2, 4, 2, 5}; int[] student3 = {3, 3, 1, 1, 2, 2, 4, 4, 5, 5}; int[] cnt = new int[3]; for (int i = 0; i < answers.length; i++) { if (answers[i] == student1[i%5]) { cnt[0]++; } if (answers[i] == student2[i%8]) { cnt[1]+..