Code RoomFlatten indented config
MediumPrep Room Coding #712

Flatten indented config

CodingAlgorithms & data structuresEntry–Mid~15 min

A CI pipeline file uses a tiny indentation format. Every non-blank line is indented by exactly 2 spaces per nesting level and contains a ":". A line whose text after the colon is empty, like "build:", opens a nested block; a line like "image: node:20" is a leaf whose value is everything after the FIRST colon, trimmed (values are never empty, and may themselves contain colons). Blank lines can appear anywhere and mean nothing. A block with no children contributes nothing. The document is well-formed. Flatten it into a dict mapping the dot-joined path of nested keys to each leaf value.

Implement
flatten_pipeline_config(lines: list[str]) → dict[str,str]
Examples
in[["build:"," image: node:20"," steps: install"]]out{"build.image":"node:20","build.steps":"install"}
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 15 min
InputExpectedGot
[["build:"," image: node:20"," steps: install"]]{"build.image":"node:20","build.steps":"install"}not run yetsample