Filter an n-ary tree by substring and render it indented

0
Remix

Each node of an n-ary tree has a string value and a list of children.

  1. Given a search string, return the filtered tree: keep every node whose value contains the substring, plus the ancestors needed to reach it; drop everything else.
  2. Render the (filtered) tree in a UI with indentation by depth, and update it as the user types in a filter box.
WaymoCodingLast asked Sep 2026
No answer yet. Write the first one; the best answer gets endorsed.