2255. Count Prefixes of a Given String
1 2 3 4 5 6 7 8 9 10 11
| class Solution { public int countPrefixes(String[] words, String s) { int count = 0; for (String word : words) { if (s.startsWith(word)) { count++; } } return count; } }
|
References
2255. Count Prefixes of a Given String