April 27, 2021
const getRank = (match: number) => (match > 1 ? 7 - match : 6)
function solution(lottos: number[], win_nums: number[]) {
let matched = 0
let wildcard = 0
lottos.forEach(num => {
if (num === 0) wildcard++
else if (win_nums.includes(num)) matched++
})
return [getRank(wildcard + matched), getRank(matched)]
}