Code Room
CodingMediumcod-g1509
Subject Config parsingLevel Entry–Mid~16 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

A feature-flag file is lines of the exact form "KEY=value" (split on the first "="). Values may mention other keys with the syntax "${OTHER}". Your linter must reject files where following such mentions can loop forever. Treat each mention of an EXISTING key as an edge from the defining key to the mentioned key; mentions of undefined names are harmless and ignored, as is any malformed "${" without a closing "}". Return true when the resulting graph contains a cycle (a key mentioning itself counts), false otherwise.

Implement
has_circular_reference(lines: list[str]) → bool
Examples
in[["A=${B}","B=${A}"]]outtrue
in[["A=${B}","B=ok"]]outfalse
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.