Code RoomParse CSV line
HardPrep Room Coding #793

Parse CSV line

CodingAlgorithms & data structuresSenior–Staff~35 min

Parse one line of RFC-4180-style CSV into a list of field strings. Fields are separated by commas. A field may be wrapped in double quotes; inside a quoted field, two consecutive double quotes ('""') represent one literal double quote, and commas inside quotes are literal (not separators). A field is quoted only if its first character is a double quote. Unquoted fields are taken verbatim. Return the list of fields; an empty input string yields ['']. Assume the line is well-formed (every opened quote is closed).

Implement
parse_csv_line(line: str) → list
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 35 min
InputExpectedGot
["a,\"b,c\",d"]["a","b,c","d"]not run yetsample