HTMLify

LeetCode - String Matching in an Array - Python
Views: 14 | Author: abh
class Solution:
    def stringMatching(self, words: List[str]) -> List[str]:
        ans = []
        for word in words:
            for word_ in words:
                if word == word_:
                    continue
                if word in word_:
                    ans.append(word)
                    break
        return ans

Comments