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

Question

Load a shell-style env file for a local dev runner. Per line: trim it; skip if empty or if it begins with "#". If what remains starts with the prefix "export " (the word plus a space), drop that prefix and trim again. Split at the first "=" (lines without "=" are skipped), trimming key and value. Finally, when a value both begins and ends with a double quote and is at least two characters long, remove exactly that outer pair — inner text stays untouched. Repeated keys: last one wins. Return the resulting dict.

Implement
parse_env_file(lines: list[str]) → dict[str,str]
Examples
in[["export API_KEY=\"abc 123\"","DEBUG=1"]]out{"DEBUG":"1","API_KEY":"abc 123"}
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.