- Difficulty
- Intermediate
- Time
- 45–60 min
Pin the rule
Take the phrase list and a small sample of strings, and state the rule that decides whether two strings belong to the same group. Name every case your rule leaves open.
What to demonstrate: Can you turn a handful of examples into a stated, testable rule?
Implement the partition
Describe the data structures and the single pass that produce the partition, with its time and space cost. Explain how the output stays stable when more than one phrase could match the same string.
What to demonstrate: Is the implementation concrete enough to reproduce, including how ties are broken?
Attack the edges
List the boundary inputs that would break a careless version: a repeated phrase, overlapping matches, case and spacing variation, and a phrase that matches nothing. State the correct output for each.
What to demonstrate: Do you locate the failure cases before an interviewer does?
Separate fact from guess
The interviewer says the examples were not exhaustive. Say which parts of your rule are still inferred, and which three inputs you would run to confirm or overturn them.
What to demonstrate: Can you distinguish verified behavior from assumption?