Algorithm · Stripe · Medium
You receive a flat list of task records, already ordered by timestamp. Reconstruct the parent-child tree they describe and print it with tree-drawing connectors. Every record takes one of two shapes: Top-level (root) record: timestamp task task_id task_name Nested (child) record: timestamp subtask parent_id task_id task_name The records obey these rules: A root record never has a parent. A child record names its parent via parent_id, and that parent may be either a root or…