가오리의 코딩일기
로또의 최고 순위와 최저 순위 본문
https://programmers.co.kr/learn/courses/30/lessons/77484
function solution(lottos, win_nums) {
const correct = lottos.filter((lotto) => win_nums.includes(lotto)).length;
const zeros = lottos.filter((lotto) => lotto === 0).length;
console.log(correct, zeros);
let min = 7 - correct >= 6 ? 6 : 7 - correct;
let max = min - zeros < 1 ? 1 : min - zeros;
return [max, min];
}
'HTML+CSS+JavaScript > 프로그래머스' 카테고리의 다른 글
[76501] 음양 더하기 (0) | 2022.06.13 |
---|---|
제일 작은 수 제거하기 (0) | 2022.06.13 |
완주하지 못한 선수 (0) | 2022.06.10 |
두개 뽑아서 더하기 (0) | 2022.06.09 |
K번째수 (0) | 2022.06.09 |