| 1 | class Solution { |
| 2 | public int countConsistentStrings(String allowed, String[] words) { |
| 3 | int counter=0; |
| 4 | HashSet<Character> set = new HashSet<Character>(); |
| 5 | for(int i=0;i<allowed.length();i++) |
| 6 | { |
| 7 | set.add(allowed.charAt(i)); |
| 8 | } |
| 9 | for(String str: words) |
| 10 | { |
| 11 | boolean flag=true; |
| 12 | for(int i=0;i<str.length();i++) |
| 13 | { |
| 14 | if(!set.contains(str.charAt(i))) |
| 15 | { |
| 16 | flag=false; |
| 17 | } |
| 18 | } |
| 19 | if(flag) counter++; |
| 20 | } |
| 21 | return counter; |
| 22 | } |
| 23 | } |
nothing calls this directly
no outgoing calls
no test coverage detected