Code Room
CodingEasycod-g1513
Subject Config parsingLevel Entry–Mid~10 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

A rollout script needs the target machines from a config file. Lines look like "key=value" after trimming; ignore blank lines, "#" comment lines, and lines lacking "=". The key is the text before the first "=" with surrounding spaces removed; if the file assigns the requested key several times, only the FINAL assignment counts. Its value is a comma-separated list: split on every comma, trim each piece, and throw away pieces that are empty after trimming. Return the pieces in the order written. If the key never appears, return an empty list.

Implement
expand_host_list(lines: list[str], key: str) → list[str]
Examples
in[["hosts=a.example, b.example ,c.example"],"hosts"]out["a.example","b.example","c.example"]
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.

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.