Programmers
-
Level.1 완전탐색 > 모의고사Programmers/Java 2021. 5. 3. 13:03
1234567891011121314151617181920212223242526272829303132333435363738394041424344import java.util.ArrayList;import java.util.Arrays;import java.util.HashMap;import java.util.List;import java.util.Collections; class Solution { public int[] solution(int[] answers) { int[] answer = {}; int[] answer_1 = {1,2,3,4,5}; int[] answer_2 = {2,1,2,3,2,4,2,5}; int[] answer_3 = {3,3,1,1,2,2,4,4,5,5}; int max = ..
-
Level.1 해시 > 완주하지 못한 선수Programmers/Java 2021. 5. 3. 13:02
123456789101112131415161718import java.util.Arrays; class Solution { public String solution(String[] participant, String[] completion) { String answer = ""; Arrays.sort(participant); Arrays.sort(completion); answer = participant[completion.length]; for(int a=0; a
-
Level.1 완전탐색 > 모의고사Programmers/Python 2021. 5. 3. 12:59
12345678910111213141516171819202122232425262728293031def solution(answers): answer = [] people1 = [1,2,3,4,5]; people2 = [2,1,2,3,2,4,2,5]; people3 = [3,3,1,1,2,2,4,4,5,5]; cor1 = 0; cor2 = 0; cor3 = 0; for i in range(0,len(answers)): if answers[i] == people1[i%5]: cor1 += 1; if answers[i] == people2[i%8]: cor2 += 1; if answers[i] == people3[i%10]: cor3 += 1; resultDic = {1:cor1, 2:cor2, 3:cor3}..