leetcode1032】的更多相关文章

Implement the StreamChecker class as follows: StreamChecker(words): Constructor, init the data structure with the given words. query(letter): returns true if and only if for some k >= 1, the last k characters queried (in order from oldest to newest,…
class StreamChecker: def __init__(self, words: 'List[str]'): self.maxLen = 0 self.List = set(words) for w in self.List: self.maxLen = max(self.maxLen,len(w)) self.STR = '' def query(self, letter: str) -> bool: if letter in self.List: return True else…