int prefixCount(char ** words, int wordsSize, char * pref){
int len=strlen(pref);
int ans=0;
for(int a=0;a<wordsSize;a++){
if(strlen(words[a])>=len){
int count=0;
for(int b=0;b<len;b++){
if(words[a][b]==pref[b]){
count++;
}
}
if(count==len){
ans++;
}
}
}
return ans;
}
力扣------统计包含给定前缀的字符串
最新推荐文章于 2024-09-03 18:29:17 发布