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

Question

An audit script summarizes a sectioned settings file. Trimmed lines of the shape "[title]" begin a section (title trimmed; the same title may begin sections in several places — they pool together). "name=data" lines (first "=", both sides trimmed) add the name to whatever section is open; names appearing before any section pool under the empty-string section, which exists in the output only if it actually received a name. Empty lines and "#" lines add nothing, yet a section title still counts even when nothing follows it. Report each section mapped to how many DISTINCT names it holds.

Implement
section_key_counts(lines: list[str]) → dict[str,int]
Examples
in[["[app]","name=x","name=y","port=1","[db]"]]out{"db":0,"app":2}
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.