Code RoomUnflatten dotted paths
MediumPrep Room Coding #713

Unflatten dotted paths

CodingAlgorithms & data structuresEntry–Mid~16 min

Turn flat dotted settings back into an indented outline for a settings editor. Input lines have the exact shape "dotted.path=value" (split at the first "="; a repeated path keeps its final value). Path segments use lowercase letters, digits, and underscores; no path is also a parent of another. Emit the outline as a list of strings: intermediate segments appear as "name:" and each final segment as "name: value", indented 2 spaces per nesting level. Siblings at every level are ordered alphabetically, and a parent line is printed once before its children. Example: ["app.port=8080"] gives ["app:", " port: 8080"].

Implement
render_config_tree(lines: list[str]) → list[str]
Examples
in[["app.name=api","app.port=8080","debug=false"]]out["app:"," name: api"," port: 8080","debug: false"]
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 16 min
InputExpectedGot
[["app.name=api","app.port=8080","debug=false"]]["app:"," name: api"," port: 8080","debug: false"]not run yetsample