...
/Check If a Word is a Prefix of Any Word in a Sentence
Check If a Word is a Prefix of Any Word in a Sentence
Try to solve the check If a word is a prefix of any word in an example problem.
We'll cover the following...
Statement
You are given a sentence containing words separated by single spaces and a searchWord. Your task is to determine whether searchWord is a prefix of any word in the sentence.
Return the 1-based index of the first word in which searchWord appears as a prefix.
If
searchWordis a prefix of multiple words, return the index of the earliest such word.If no word starts with
searchWord, return...
Ask