JAVA_LeetCode 1684_Count the Number of Consistent Strings 풀이 class Solution { public int countConsistentStrings(String allowed, String[] words) { // set에 중복값을 제거해서 담는다. Set set = new HashSet(); for (char c : allowed.toCharArray()) set.add(c); // 하나라도 포함되지 않으면 더하지 않음 int cnt = 0; boolean flag = true; for(int i = 0; i < words.length; i++){ flag = true; for(char c : words[i].toCharArray()){ if(!
set.contains(c)) flag = false; } if(flag) cnt++; } return cnt; } } * 출처 https://leetcode.com...
#
JAVA
#
JAVA_CounttheNumberofConsistentStrings
#
JAVA_LeetCode1684
#
JAVA_LeetCode1684_CounttheNumberofConsistentStrings
#
LeetCode1684_CounttheNumberofConsistentStrings