JAVA
[프로그래머스/자바] 외계어 사전
동백05
2023. 9. 4. 21:46
https://school.programmers.co.kr/learn/courses/30/lessons/120869
class Solution {
public int solution(String[] spell, String[] dic) {
int answer = 2;
int length = spell.length;
for(int i=0;i<dic.length;i++){
int count = 0;
if(dic[i].length()==length){
for(int j=0;j<length;j++){
if(dic[i].contains(spell[j])){
count++;
}
}
if(count==length){
answer=1;
}
}
}
return answer;
}
}