JAVASCRIPT/코딩테스트
[프로그래머스] 0단계 - 외계어 사전
예글
2024. 1. 30. 16:40
1. 문제 설명
2. 답안
function solution(spell, dic) {
let answer = []
for(let item of dic){
let arr = []
for(let i = 0; i < spell.length; i++){
arr.push(item.includes(spell[i]))
}
answer.push(arr)
}
return answer.filter(x => !x.includes(false)).length > 0 ? 1 : 2
}