ByteDance / TikTok logoByteDance / TikTok
Coding·30 minMembers

Build a Nested Comment Tree from Flat Records

Members only

Transform a flat list of comment objects with id, parent_id, and text into a nested root array by attaching children recursively. The supplied example contains two roots and a grandchild, plus a paren...

SWE
tree
hashmap
data-modeling
medium
Frequency
Single report
Last asked
2026-08-13
Stage
phone-screen

Log in to continue reading the full content

Comments

Sign in to join the discussion
Loading...