1455. Check If a Word Occurs As a Prefix of Any Word in a Sentence ¶ Time: Space: Python 1 2 3 4 5 6 7 8 9class Solution: def isPrefixOfWord(self, sentence: str, searchWord: str) -> int: words = sentence.split() for i, word in enumerate(words): if word.startswith(searchWord): return i + 1 return -1