[프로그래머스]외계어 사전

박예림·2023년 5월 3일
0

코테

목록 보기
76/132

import java.util.*;
class Solution {
    public int solution(String[] spell, String[] dic) {
       for (int i = 0; i < dic.length; i++) {
            int count = 0;

            for (int j = 0; j < spell.length; j++) {
                if (dic[i].contains(spell[j])) {
                    count++;
                }
            }

            if (count == spell.length) {
                return 1;
            }
        }
        return 2;
    }
}
profile
응애 나 아기개발자

0개의 댓글