Stream suffix word matcher
You build a matcher from a list of lowercase words, then feed it characters one at a time via a stream. After each character, return whether any of the stored words is a suffix of the characters received so far. Implement a single function that takes the word list and a string of streamed characters, and returns a list of booleans (one per streamed character). Words and stream up to a few thousand characters total.
Implement
stream_suffix_match(words: list[str], stream: str) → list[bool]Examples
in
[["cd","f"],"abcd"]out[false,false,false,true]What a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
0:00 of about 35 min
solution.py
InputExpectedGot
[["cd","f"],"abcd"][false,false,false,true]not run yetsample