[프로그래머스][자바스크립트][Level1] 모의고사
/** * 모의고사 * 완전탐색 */ function solution(answers) { const supoja = [0, 0, 0]; const supojaPattern = [[1, 2, 3, 4, 5], [2, 1, 2, 3, 2, 4, 2, 5], [3, 3, 1, 1, 2, 2, 4, 4, 5, 5]]; answers.forEach((val, idx) => { for (let i = 0; i < supojaPattern.length; i++) { if (val === supojaPattern[i][idx%supojaPattern[i].length]) supoja[i]++; } }); const max = Math.max(...supoja); return supoja.reduce((rst, matc..
2022. 1. 3.