Search⌘ K
AI Features

Stream of Characters

Understand how to implement a data structure that processes a continuous stream of characters and checks if any suffix matches words from a predefined list. This lesson helps you build a StreamChecker class in C# that supports efficient querying and suffix detection for coding interview problems.

Statement

Design a data structure that processes a stream of characters and, after each character is received, determines if a suffix of these characters is a string in a given array of strings words.

For example, if words = ["dog"] and the stream adds the characters ‘d’, ‘c’, ‘a’\text{`d', `c', `a'}, and ‘t’\text{`t'} ...