← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
You are given a flat list of Reddit-style comments. Each comment has an id, a parent_id (which may be null for top-level comments), and a text body. Your task is to render these comments into a hierarchical UI that visually nests replies under their parents with increasing indentation (4 spaces per depth level). You must build the tree in memory and then output the comments in depth-first order so that every comment appears after its parent and before its younger siblings, with its depth reflected by leading spaces.