Chunked transfer encoding
HTTP/1.1 supports chunked transfer encoding: the body is a series of chunks, each prefixed by its size in hexadecimal followed by CRLF, then the chunk data and a trailing CRLF. A chunk-size line may carry optional chunk extensions after a ';' which you must ignore. The body terminates with a zero-size chunk ('0\r\n\r\n'). Given the raw chunked body string, return the decoded message. Sizes are valid hex; the body is well-formed.
Implement
decode_chunked(body: str) → strExamples
in
["4\r\nWiki\r\n5\r\npedia\r\n0\r\n\r\n"]out"Wikipedia"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.
0:00 of about 20 min
solution.py
InputExpectedGot
["4\r\nWiki\r\n5\r\npedia\r\n0\r\n\r\n"]"Wikipedia"not run yetsample