Question
Strip comments from a source string while respecting string literals. A line comment starts with '//' and runs to the end of the line (the newline itself is kept). A block comment starts with '/*' and runs to the next '*/' (which may span lines); block comments do not nest. However, '//', '/*', and '*/' that appear inside a double-quoted string literal are NOT comment markers. String literals are delimited by double quotes and may contain a backslash-escaped quote ('\"') which does not close the string. Comment markers are never split across a string boundary in valid input. Remove all comment text (replace it with nothing) and return the resulting string. Assume every string literal and block comment is properly closed.
strip_comments(src: str) → str["int x = 5; // set x\nx++;"]out"int x = 5; \nx++;"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.