Code RoomParse shell env file
EasyPrep Room Coding #727

Parse shell env file

CodingAlgorithms & data structuresEntry–Mid~11 min

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.

0:00 of about 11 min
InputExpectedGot
[["export API_KEY=\"abc 123\"","DEBUG=1"]]{"DEBUG":"1","API_KEY":"abc 123"}not run yetsample