Code Room
CodingMediumcod-g682
Subject ParsingLevel Mid–Senior~25 minCommon in Databases & SQL · Algorithms & data structures interviewsIndustries Software development

Question

Parse a URL query string into a dict. The string is a '&'-separated list of 'key=value' pairs. Apply percent-decoding to both keys and values: '%XX' is a hex byte (decode as a single ASCII character), and '+' decodes to a space. A pair with no '=' has an empty-string value. If a key repeats, the LAST occurrence wins. An empty input yields an empty dict. Return the resulting dict.

Implement
parse_query(qs: str) → dict[str,str]
Examples
in["name=John+Doe&city=NYC"]out{"city":"NYC","name":"John Doe"}
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.