Code Room
CodingHardcod-g233
Subject TokenizationLevel Senior–Staff~35 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

Tokenize a string that may contain double-quoted string literals and bare words separated by spaces. A string literal starts and ends with a double quote and supports backslash escapes inside: '\n' -> newline, '\t' -> tab, '\"' -> a literal double quote, '\\' -> a literal backslash; any other escape '\x' yields the character x literally. Bare words are maximal runs of non-space, non-quote characters. Spaces outside quotes separate tokens and are discarded. Return a list of the decoded token strings in order (quotes themselves are not part of the value). Assume every opened quote is closed. Empty or all-space input returns an empty list.

Implement
lex_strings(src: str) → list
Examples
in["hello \"a b\" world"]out["hello","a b","world"]
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.

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.

Run or narrate your approach, then ask the coach.