1408. String Matching in an Array

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 1408

class Solution:
    def stringMatching(self, words: List[str]) -> List[str]:
        res = []
        for i, s in enumerate(words):
            if any(i != j and s in t for j, t in enumerate(words)):
                res.append(s)
        return res