Code Room
CodingHardcod-g814
Subject Suffix structuresLevel Senior–Staff~35 minCommon in Distributed systems · Algorithms & data structures interviewsIndustries Software development

Question

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.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.