Leetcode1408——数组中的字符串匹配

在这里插入图片描述
在这里插入图片描述

思路

在这里插入图片描述

class Solution:
    def stringMatching(self, words: List[str]) -> List[str]:
        c=[]
        for i in range(len(words)):
            for j in range(len(words)):
                if i!=j:
                    if words[i] in words[j]:
                        c.append(words[i])
                        break
        return c

猜你喜欢

转载自blog.csdn.net/weixin_44441131/article/details/106483272