2020 第 22 周 LeetCode 记录

Yiran at 
1455. Check If a Word Occurs As a Prefix of Any Word in a Sentence 链接到标题 切分句子然后遍历判断是否为前缀,需要返回索引 + 1。class Solution: def isPrefixOfWord(self, sentence: str, searchWord: str) -> int: for idx, w in enumerate(sentence.split(' ')): if w.startswith(searchWord): return idx + 1 else: return -1 1456. Maximum……