class Solution: def numMatchingSubseq(self, S: str, words: List[str]) -> int: m=0 for i in range(len(words)): j=0 t=S while j<len(words[i]): if words[i][j] in t: d=t.index(words[i][j]) t=t[d+1:] j+=1 else: break if j==len(words[i]): m+=1 return m
耗时太多,如何优化???
有人说用双指针,我还没试。
——2019.10.16
原文:https://www.cnblogs.com/taoyuxin/p/11687221.html