int findString(char** words, int wordsSize, char* s){
int lens=strlen(s);
for(int a=0;a<wordsSize;a++){
int len=(strlen(words[a]));
if(len==lens){
int count=0;
for(int b=0;b<lens;b++){
if(s[b]==words[a][b]){
count++;
}
}
if(count==lens){
return a;
}
}
}
return -1;
}
力扣------ 稀疏数组搜索
最新推荐文章于 2024-07-25 21:13:04 发布