def parse_csv(text):
Two Waymo phone-screen reports (March and April 2026) describe this round. In both, the recruiter had said to expect a LeetCode problem. Instead the interviewer gave a CSV string with a single example and asked how to process it so other engineering teams can use it (in one report, out loud with no written prompt). Pure Python only: one candidate said pandas would do it in two lines, and the interviewer still wanted it written from scratch.
The interviewer said there is no one right answer and the output format is up to you, so the function names and shapes below are our setup. They are the shapes the candidate who passed chose. Ask what the downstream users need before you code; the clarifications list the questions.
The input is one string: a header line, then one line per row, with values separated by commas. The reported example is "col1,col2,col3,col4 \n value1,value2,value3,value4 \n". Our setup: strip the spaces around each field and skip blank lines, so the trailing newline adds no row. Values stay strings: the interviewer wanted a generic solution, so no data type is assumed.
Part 1 — Parse clean CSV
Assume the data is clean: every row has one value per header column.
parse_csv(text: str) -> dict[str, list[str]] returns {column_name: [values in row order]}. For the example that is {"col1": ["value1"], "col2": ["value2"], "col3": ["value3"], "col4": ["value4"]}.The candidate who passed listed three cases: missing values, extra values and wrong data types. The interviewer said the solution must be generic, so data types cannot be assumed, which leaves missing and extra values. That candidate switched to a dict keyed by row index, each value a {col_name: value} dict with a final is_valid field set by checking the row's number of values, so the people using the data can filter to valid rows or inspect the invalid ones for cleaning.
In one report the candidate pointed out that pandas would take two lines; the interviewer still wanted it written from scratch with no packages. The parsing itself is short (split on newlines, then on commas), so the round turns on how you shape the output and handle bad rows.
From two Waymo phone-screen reports (March and April 2026), one of them for a SWE role. In both, the recruiter had said to expect a LeetCode problem, medium in one and medium-to-hard in the other. Instead the interviewer set a CSV-processing task with one example; in one report it was given out loud with no written prompt, and the interviewer said it was a question they had made up. One candidate found it so open that, when asked what they were looking for, the interviewer said there is no correct answer and they wanted to see where it goes; that candidate felt they did only so-so. The candidate who passed parsed the string into a dict of columns, discussed other shapes, and then handled the corrupted-data follow-up with a dict keyed by row index and an is_valid field. Their advice: the code is easy, and the round is about asking what the function should produce and agreeing on it before coding.
Two Waymo phone-screen reports (March and April 2026) describe this round. In both, the recruiter had said to expect a LeetCode problem. Instead the interviewer gave a CSV string with a single example and asked how to process it so other engineering teams can use it (in one report, out loud with no written prompt). Pure Python only: one candidate said pandas would do it in two lines, and the interviewer still wanted it written from scratch.
The interviewer said there is no one right answer and the output format is up to you, so the function names and shapes below are our setup. They are the shapes the candidate who passed chose. Ask what the downstream users need before you code; the clarifications list the questions.
The input is one string: a header line, then one line per row, with values separated by commas. The reported example is "col1,col2,col3,col4 \n value1,value2,value3,value4 \n". Our setup: strip the spaces around each field and skip blank lines, so the trailing newline adds no row. Values stay strings: the interviewer wanted a generic solution, so no data type is assumed.
Part 1 — Parse clean CSV
Assume the data is clean: every row has one value per header column.
parse_csv(text: str) -> dict[str, list[str]] returns {column_name: [values in row order]}. For the example that is {"col1": ["value1"], "col2": ["value2"], "col3": ["value3"], "col4": ["value4"]}.Part 2 — Flag corrupted rows
The follow-up: the data may be corrupted. The header is always correct, but a row can have missing values or extra values. Keep every row and flag it, so the people using the data can keep only the good rows or look at the bad ones to clean them.
parse_csv_rows(text: str) -> dict[int, dict] returns {row_index: {column_name: value, ..., "is_valid": bool}}, with rows numbered from 0 in file order. is_valid is True exactly when the row has one value per header column. On an invalid row the tests check only is_valid, not which values it keeps.How would you handle corrupted data in the CSV? Assume the header row is always correct.
Can you write it from scratch in pure Python, without any packages?
| Approach | Notes |
|---|---|
| Column-oriented dict {col_name: [values]} | The passing candidate's first shape. Easy to read one column; there is no natural place for a per-row is_valid flag. |
| Row-index-keyed dict {row_index: [values]} | Another shape that candidate discussed. Keeps each row's position, but values are reached by column position rather than name. |
| Row-index-keyed dict {row_index: {col_name: value, is_valid: bool}} | The shape that candidate used for the corrupted-data follow-up. Rows keep their position and can carry the is_valid flag. |
Common mistakes: Relying on pandas: one candidate pointed out it would take two lines, and the interviewer still required pure Python.; Not proactively estimating downstream needs when the problem is open-ended; one candidate reflected afterward that self-estimating requirements was likely what was expected.
Interviewer hints: Interviewer said there is no correct answer and wanted to see 'where it goes' — signaling that design reasoning matters more than the specific output format.; Interviewer explicitly said the solution must be 'very generic,' ruling out data-type validation and narrowing corrupted-data handling to missing and extra fields only.; When pandas was proposed, the interviewer still required writing from scratch — no external packages.; Interviewer gave only a single example row via verbal description and asked the candidate to take notes, with no written problem statement.
What passers do: Proactively asked clarifying questions and proposed multiple output formats with pros/cons before writing any code, then confirmed the interviewer was on the same page.; Added an is_valid boolean field to each row's dict so downstream consumers can filter valid rows or investigate invalid ones — framed it explicitly as a downstream-usability decision.; Listed the ways a row can be corrupted (missing values, extra values, wrong types); the interviewer then ruled out type checks because the solution must be generic.
If you have had this round, tell us how close this page was. It is how we keep the pages accurate.