Code Room
CodingMediumcod-g1155
Subject Networking protocolsLevel Mid–Senior~22 minCommon in Security · Networking & APIs · Algorithms & data structures interviewsIndustries Software development, IT services

Question

Parse an HTTP Authorization / WWW-Authenticate header into its scheme and parameters. The header is 'Scheme param1=value1, param2="value 2", ...'. The scheme is the first whitespace-delimited token. Parameters follow as comma-separated key=value pairs; values may be bare tokens or double-quoted strings, and a quoted value may itself contain commas (which must NOT be treated as parameter separators). Strip surrounding quotes from values. If there are no parameters (e.g. 'Bearer abc123'), return an empty params dict. Return [scheme, params_dict].

Implement
parse_auth_params(header: str) → list
Examples
in["Digest realm=\"test\", nonce=\"abc\", qop=auth"]out["Digest",{"qop":"auth","nonce":"abc","realm":"test"}]
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.