Th isn’t a word, next
The is a word, look up ‘reis’, not a word, next
Ther isn’t a word, next
There is a word, look up ‘is’ it is a word, return true
If you don’t want to ignore whitespace, than I’m not sure what behavior you want, you want “there is” to return false?
If whitespace is the delimiter the whole thing is trivial, you split on space.
I am now more confused.
This is where the wrong greedy solution from TFA, which the author claims some candidates reach, stops. So it's wrong.
Note that if you do not stop, and continue as in your own example, your solution isn't "greedy"!
Or at least sorting by.
Th isn’t a word, next
The is a word, look up ‘reis’, not a word, next
Ther isn’t a word, next
There is a word, look up ‘is’ it is a word, return true
If you don’t want to ignore whitespace, than I’m not sure what behavior you want, you want “there is” to return false?
If whitespace is the delimiter the whole thing is trivial, you split on space.
I am now more confused.