Searching and filtering in memory: indexes and composable filters
When a prompt says "filter by this, this and this", two questions follow: how does a caller say what they want, and which recipes, books or orders do you read to answer? This move makes each condition a small object that combines with others, and it starts each search from the shortest index. It combines Strategy for one condition, Composite for "and", "or" and "not", and the indexes of a repository. Interviewers listen for which questions your design can't ask, and for when a plain loop is enough.
A detective and her lists
Think of a detective with a witness's clues: lives on Mill Street, wears glasses, walks with a limp. She has two lists from the town hall. The Mill Street list has 40 names, and the opticians' list has 3,000. Nobody keeps a list of people who limp, so that clue can only be checked by looking at each person.
She doesn't walk to 3,000 doors. She starts from the shortest list that covers the clues, the 40 names, and at each door she checks all the clues. Sometimes the witness changes the clues: "either the Mill Street man or someone with a limp", or "not the baker". She writes each clue on its own card and clips cards together, so that any new combination is just another set of cards.