Nextdoor logoNextdoor
CodingMembers

Build Comment Trees from Parent IDs

Members only

A flat list of comments, each pointing at its parent, has to be reorganized into threaded reply trees. The interesting part is doing it efficiently and being explicit about messy inputs such as out-of-order entries and missing parents. A follow-up asks you to render the result as an indented outline.

SWE
medium
hashmap
tree
tree-traversal
java
Frequency
Single report
Last asked
—
Stage
phone-screen

Members get

  • Full problem statement
  • 3 progressive hints
  • Step-by-step approach
  • Full solution with code
  • 6 talking points
  • 5 follow-up questions with answer directions
  • Preparation drills

Log in to continue reading the full content

Comments

Sign in to join the discussion
Loading...