Prompt 1
Filter a tree by substring and render it indented
Practice version modelled on a reported round: Public report: Waymo senior frontend engineer loop, May 2026
What this measures
Clarify first
Confirm match semantics: substring or exact, case-sensitive or not, and what an empty term should do. Confirm whether a matching root removes everything and whether ancestors of a surviving node must stay visible.
Strong answer should cover
Walk the tree depth-first and decide at each node whether it survives; skip the subtree of a pruned node instead of filtering afterwards. Carry depth with each node so indentation or nesting is derived during the walk. Keep sibling order and never mutate the input tree. Rendering as UI: map the same walk to nested list elements and keep expand and collapse state outside the traversal. Test a matching root, an empty term, case sensitivity, deep nesting and a node without children.
Common miss: