2020 第 22 周 LeetCode 记录

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