CSV line parser
Parse a single CSV line into a list of fields following RFC-4180-style quoting. Fields are comma-separated. A field may be wrapped in double quotes, in which case it may contain commas and newlines, and a literal double quote is written as two double quotes (""). Unquoted fields are taken verbatim. Leading/trailing spaces are NOT trimmed. Return the list of decoded field strings. The input contains no trailing newline.
Implement
parse_csv_line(line: str) → list[str]Examples
in
["a,\"b,c\",d"]out["a","b,c","d"]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 30 min
solution.py
InputExpectedGot
["a,\"b,c\",d"]["a","b,c","d"]not run yetsample