Question
Parse a raw HTTP request. The request is a string with lines separated by CRLF (\r\n); the request line comes first (METHOD PATH VERSION), followed by zero or more 'Name: Value' header lines, terminated by a blank line. Return [method, path, version, headers] where headers is a dict mapping lowercased header names to their trimmed values. Assume each header name appears at most once.
parse_request(raw: str) → list["GET /index.html HTTP/1.1\r\nHost: example.com\r\nAccept: text/html\r\n\r\n"]out["GET","/index.html","HTTP/1.1",{"host":"example.com","accept":"text/html"}]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.