PracHub
QuestionsLearningGuidesInterview Prep
|Home/Software Engineering Fundamentals/Waymo

Build an Interactive Filtered Tree View

Last updated: Jul 14, 2026

Quick Overview

Build an accessible interactive tree view that removes matching nodes and their subtrees as filter text changes. Separate pure immutable filtering from rendering, preserve stable identity and focus, and address debouncing, deep traversal, memoization, virtualization, and keyboard navigation.

  • medium
  • Waymo
  • Software Engineering Fundamentals
  • Frontend Engineer

Build an Interactive Filtered Tree View

Company: Waymo

Role: Frontend Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Onsite

# Build an Interactive Filtered Tree View Build a frontend component that accepts an n-ary tree and a text filter. If a node's value contains the filter text, remove that node and its entire subtree from the rendered result. Render the remaining hierarchy with correct indentation, and update the view whenever the input changes. ### Constraints & Assumptions - The tree may contain tens of thousands of nodes and may be deeply skewed. - Child order is meaningful and must be preserved. - Matching is case-sensitive unless product requirements say otherwise. - The source tree is immutable application data; filtering must not mutate it. - An empty filter shows the complete tree. - The UI must be keyboard accessible and understandable without indentation alone. ### Clarifying Questions to Ask - Should a matching parent hide all descendants even when a descendant does not match? - Must partially matching ancestor paths remain visible, or is this strictly subtree removal? - How frequently does the source tree change relative to the filter input? - Is virtualization required for the expected data size? - Should filtering happen immediately, after a debounce, or only on submit? ### Hints - Keep the filtering rule in a pure function separate from rendering. - Use stable node identities for framework keys; array positions are not stable identities. - Consider how recursion depth and rendering cost behave for pathological input. ### What a Strong Answer Covers - A precise data contract and a pure, testable filter transformation. - Correct subtree removal, preserved child order, and immutable state handling. - Semantic nested-list or tree markup, keyboard behavior, focus stability, and accessible labels. - Controlled input state, cancellation or debounce policy, and avoidance of stale derived state. - Memoization based on real bottlenecks, iterative traversal for deep trees, and virtualization for very large visible results. - Unit tests for root removal, nested matches, empty filters, duplicate labels, rapid input changes, and deep trees. ### Follow-up Questions 1. How would you preserve expansion and focus state when filtering changes the visible nodes? 2. When would memoization make this component slower rather than faster? 3. How would you virtualize a hierarchy while maintaining indentation and accessibility? 4. How would you make matching case-insensitive and locale-aware without changing the tree algorithm?

Quick Answer: Build an accessible interactive tree view that removes matching nodes and their subtrees as filter text changes. Separate pure immutable filtering from rendering, preserve stable identity and focus, and address debouncing, deep traversal, memoization, virtualization, and keyboard navigation.

Related Interview Questions

  • Design and Implement a Cross-System Object Tracker - Waymo (medium)
  • Build a Debounced Autocomplete Search Bar - Waymo (medium)
  • Run Promise Tasks with Bounded Concurrency - Waymo (medium)
  • Debug an Angular UI from User Reports - Waymo (medium)
|Home/Software Engineering Fundamentals/Waymo

Build an Interactive Filtered Tree View

Waymo logo
Waymo
May 11, 2026, 12:00 AM
mediumFrontend EngineerOnsiteSoftware Engineering Fundamentals
1
0

Build an Interactive Filtered Tree View

Build a frontend component that accepts an n-ary tree and a text filter. If a node's value contains the filter text, remove that node and its entire subtree from the rendered result. Render the remaining hierarchy with correct indentation, and update the view whenever the input changes.

Constraints & Assumptions

  • The tree may contain tens of thousands of nodes and may be deeply skewed.
  • Child order is meaningful and must be preserved.
  • Matching is case-sensitive unless product requirements say otherwise.
  • The source tree is immutable application data; filtering must not mutate it.
  • An empty filter shows the complete tree.
  • The UI must be keyboard accessible and understandable without indentation alone.

Clarifying Questions to Ask Guidance

  • Should a matching parent hide all descendants even when a descendant does not match?
  • Must partially matching ancestor paths remain visible, or is this strictly subtree removal?
  • How frequently does the source tree change relative to the filter input?
  • Is virtualization required for the expected data size?
  • Should filtering happen immediately, after a debounce, or only on submit?

Hints

  • Keep the filtering rule in a pure function separate from rendering.
  • Use stable node identities for framework keys; array positions are not stable identities.
  • Consider how recursion depth and rendering cost behave for pathological input.

What a Strong Answer Covers Guidance

  • A precise data contract and a pure, testable filter transformation.
  • Correct subtree removal, preserved child order, and immutable state handling.
  • Semantic nested-list or tree markup, keyboard behavior, focus stability, and accessible labels.
  • Controlled input state, cancellation or debounce policy, and avoidance of stale derived state.
  • Memoization based on real bottlenecks, iterative traversal for deep trees, and virtualization for very large visible results.
  • Unit tests for root removal, nested matches, empty filters, duplicate labels, rapid input changes, and deep trees.

Follow-up Questions Guidance

  1. How would you preserve expansion and focus state when filtering changes the visible nodes?
  2. When would memoization make this component slower rather than faster?
  3. How would you virtualize a hierarchy while maintaining indentation and accessibility?
  4. How would you make matching case-insensitive and locale-aware without changing the tree algorithm?
Loading comments...

Browse More Questions

More Software Engineering Fundamentals•More Waymo•More Frontend Engineer•Waymo Frontend Engineer•Waymo Software Engineering Fundamentals•Frontend Engineer Software Engineering Fundamentals

Write your answer

Your first approved answer each day earns 20 XP.

Sign in to write your answer.
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.