image_2022-03-19_01-13-18.png
27.8 KB
#N2185. Counting Words With a Given Prefix
problem link
#solution
problem link
#solution
class Solution {
public int prefixCount(String[] words, String pref) {
int count=0;
for(String word: words){
if(word.startsWith(pref))
count++;
}
return count;
}
}🔥2