char ** stringMatching(char ** words, int wordsSize, int* returnSize){
char **a = (char **)malloc(sizeof(char *) * wordsSize);
int pos = 0;
for (int i = 0; i < wordsSize; i++) {
for (int j = 0; j < wordsSize; j++) {
if (i != j && strstr(words[j], words[i])) {
a[pos++] = words[i];
break;
}
}
}
*returnSize = pos;
return a;
}
力扣简单题:数组中的字符串匹配
最新推荐文章于 2024-09-16 06:54:08 发布