Question
Parse an HTTP Accept-Language header and return the language tags in server preference order. The header is a comma-separated list of tags, each optionally carrying a quality weight ';q=VALUE' (a float in [0,1]); a tag with no q defaults to q=1.0. Sort by q descending; tags with equal q must retain their original left-to-right order (stable). Trim whitespace. An empty header returns an empty list.
parse_accept_language(header: str) → list[str]["en-US,en;q=0.9,fr;q=0.8"]out["en-US","en","fr"]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.