AO
Back

CSV Data Processing and Formatting

Phone ScreenPhone ScreenLast reported April 2026Low Frequency

Problem Overview

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.

Follow-up Arc

Interviewers escalate through these phases. The order varies, but most candidates see at least one from each bucket.
Trade-off discussion · 2
Trade-off discussion

How would you handle corrupted data in the CSV? Assume the header row is always correct.

Probes for: After the clean-data version

Can you write it from scratch in pure Python, without any packages?

Probes for: Candidate proposes using pandas or another library

Approach Trade-offs

Approaches actually attempted in reports — including ones that lost candidates time. Pick deliberately.
ApproachNotes
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.

What Reports Emphasize

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.

Practice

Write your own against 7 test cases, or read the worked solution — approach, complexity, and code that runs.
Did this match your interview?

If you have had this round, tell us how close this page was. It is how we keep the pages accurate.

Waymo · Phone Screen · Reported 2× across candidate reports
Is this helpful?