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

Question

To diff dotfiles across machines you first rewrite each file into a canonical form. Given the raw lines: trim each line, drop those that are empty or start with "#", and split the rest at the first "=" (trim the key and the value; a key assigned more than once keeps only its final value). Then print one "key=value" string per surviving key — no spaces around the "=" — with the keys in ascending alphabetical order. Return that list. Example: ["b = 2", "a=1", "b=3"] becomes ["a=1", "b=3"].

Implement
canonical_lines(lines: list[str]) → list[str]
Examples
in[["b = 2","a=1","b=3"]]out["a=1","b=3"]
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.