DS&A in Driving Scenarios
- Run the Waymo translation drill: read the driving story, name the structure, then code it
- Work an occupancy-grid reach count, a detection-window merge and a fleet tracker end to end
- Keep the computer-science core correct while the driving story stays cosmetic
Waymo is an Alphabet company, so the coding bar is Google-grade: language-agnostic data structures and algorithms in the medium-to-hard range, solved live. What makes a round feel like Waymo rather than a generic Google loop is the costume. The prompt is rarely an abstract puzzle. It is a grid of city blocks with an obstacle in it, a collision between two objects you reason about before you type, a fleet of cars reporting positions over time. The structure underneath is a breadth-first search, an interval sweep, a hashmap. The self-driving scene is narrative. This lesson teaches the one skill that costume demands, the translation from story to structure, and then works three problems that live entirely inside it.
The translation drill
Every driving-flavored prompt yields to the same three-move drill. The discipline is doing the moves in order instead of jumping to code from the surface story. First, restate the scene in your own words until the physics or the map stops being the point. Second, name the underlying structure out loud: a grid you flood-fill, a set of intervals you sweep, or a keyed lookup holding the latest value. Third, and only third, write the ordinary code for that structure. The failure mode is skipping straight to move three. You hear the word collision and model velocity vectors when the problem wanted a comparison and a direction. Or you reach for a weighted shortest path when a plain breadth-first search on an unweighted grid was all it needed.
Say the structure before you touch the keyboard. For each of the three problems below, the driving story is doing one job: hiding a first-year data structure behind a scene from the road. An occupancy grid is a graph you explore level by level. Overlapping detection windows are intervals you merge after a sort. A fleet reporting positions is a dictionary you overwrite. Name it, and the physics or the map falls out as a detail of the setup, not the substance of the code.
The Byteboard screen and the live loop both weight this. Byteboard is a project-style assessment: you read a scenario, write code against it, and explain your choices in short-answer boxes. A clear working solution you can justify beats a clever fragment. The live domain-flavored round escalates constraints mid-problem, and the interviewer watches how your model bends. Build something that runs, narrate the reduction as you go, then be ready to change it. Each of the three problems below is the standard structure, worked in full, with the driving skin kept honest and cosmetic.
Occupancy grid: reachable cells before the hazard
The most Waymo of the standard shapes is the occupancy grid. A cell is either drivable or blocked, the vehicle sits on one square, and the question is some flavor of how far it can get. Reading how many cells are reachable inside a fixed number of moves is a breadth-first search with a step budget, nothing more. The driving frame, a hazard closing in so the vehicle has only so many moves to plan around, is the costume over an ordinary level-order flood fill.
Occupancy Grid: Reachable Cells in a Step Budget
Problem
grid, a 2D array where 0 is a drivable cell and 1 is an obstacle. The vehicle starts at start = [row, col]. It moves one cell at a time up, down, left, or right, never onto an obstacle and never off the grid. Given an integer budget, return the number of distinct cells the vehicle can occupy using at most budget moves, counting the starting cell itself.If the start cell is an obstacle, the vehicle cannot be there, so the answer is
0.Input: grid = [[0,0,1],[0,1,0],[0,0,0]], start = [0,0], budget = 3
Output: 5
From (0,0) the reachable cells within 3 moves are (0,0), (0,1), (1,0), (2,0), and (2,1). The cell (2,2) sits 4 moves away, past the budget.
Input: grid = [[0,0],[0,0]], start = [0,0], budget = 1
Output: 3
One move reaches (0,1) and (1,0); together with the start that is 3 cells.
Breadth-first search carries distance outward one ring at a time. Push the start with distance 0, and when you pop a cell whose distance already equals the budget, stop expanding from it. Every cell you mark visited within the budget counts once.
Occupancy Grid: Reachable Cells in a Step Budget
Click "Run" to execute your code
Test Cases
[[[0,0,1],[0,1,0],[0,0,0]],[0,0],3]Expected: 5[[[0,0,1],[0,1,0],[0,0,0]],[0,0],0]Expected: 1[[[0,0,1],[0,1,0],[0,0,0]],[0,0],10]Expected: 7[[[0,0,1],[0,1,0],[0,0,0]],[0,2],3]Expected: 0[[[0]],[0,0],5]Expected: 1[[[0,0],[0,0]],[0,0],1]Expected: 3Detection windows: merging overlapping intervals
The perception stack fires a detection every time a sensor believes an object is present, each detection covering a small window of time. Several sensors watching the same object produce windows that touch and overlap, and the consumer wants one consolidated span per real detection rather than a pile of fragments. Stripped of the sensor story, that is Merge Intervals: sort by start, sweep once, and fuse anything that touches. The costume is the detection stream; the structure is the interval sweep.
Detection Windows: Merge Overlapping Intervals
Problem
windows where windows[i] = [start, end] is one time window during which a sensor reported a detection. Two windows belong to the same real detection when they overlap or merely touch, so [1,3] and [2,6] fuse into [1,6], and [1,4] and [4,5] fuse into [1,5] because they meet at the endpoint.Merge every group of connected windows and return the consolidated windows sorted by start time.
Input: windows = [[1,3],[2,6],[8,10],[15,18]]
Output: [[1,6],[8,10],[15,18]]
[1,3] and [2,6] overlap into [1,6]. The other two touch nothing and pass through.
Input: windows = [[1,4],[4,5]]
Output: [[1,5]]
They meet at 4, and touching counts as connected, so they fuse into [1,5].
Sort by start time, then sweep left to right holding the last merged window open. For each next window, if its start is at or before the held end, extend the held end to the larger of the two. Otherwise a real gap sits between them, so start a fresh window.
Detection Windows: Merge Overlapping Intervals
Click "Run" to execute your code
Test Cases
[[[1,3],[2,6],[8,10],[15,18]]]Expected: [[1,6],[8,10],[15,18]][[[1,4],[4,5]]]Expected: [[1,5]][[]]Expected: [][[[1,4]]]Expected: [[1,4]][[[1,4],[2,3]]]Expected: [[1,4]][[[5,6],[1,3],[2,4]]]Expected: [[1,4],[5,6]]The fleet tracker: latest position per car
The third shape is a stream. Cars in the fleet report their positions over time, the updates arrive in chronological order, and a monitor wants each car's most recent position. This is a documented Waymo round: track car positions, return the latest per car, then have the interviewer bound the history and watch you adapt. The base case is a hashmap keyed by car, where a later ping simply overwrites the earlier one. No sorting of the stream, no scan back through history, just a keyed lookup that always holds the freshest value.
Fleet Tracker: Latest Position Per Car
Problem
updates in chronological order, where updates[i] = [car_id, x, y] records that vehicle car_id reported position (x, y). A later update for the same car supersedes its earlier ones.Return each car's most recent position as a list of
[car_id, x, y], sorted by car_id ascending.Input: updates = [[1,0,0],[2,5,5],[1,1,1],[3,2,2],[2,6,6]]
Output: [[1,1,1],[2,6,6],[3,2,2]]
Car 1 last reported (1,1), car 2 last reported (6,6), car 3 reported (2,2). Output is ordered by car id.
Input: updates = [[5,1,1],[5,2,2],[5,3,3]]
Output: [[5,3,3]]
Only car 5 appears; its last report (3,3) wins.
Walk the updates once, storing each car id to its current position in a hashmap. Because the stream is chronological, a plain overwrite keeps the latest. At the end, read the map out in sorted key order.
Fleet Tracker: Latest Position Per Car
Click "Run" to execute your code
Test Cases
[[[1,0,0],[2,5,5],[1,1,1],[3,2,2],[2,6,6]]]Expected: [[1,1,1],[2,6,6],[3,2,2]][[]]Expected: [][[[7,3,4]]]Expected: [[7,3,4]][[[2,0,0],[1,9,9],[2,1,1]]]Expected: [[1,9,9],[2,1,1]][[[5,1,1],[5,2,2],[5,3,3]]]Expected: [[5,3,3]]What is costume, and what is not
The three problems above share one design: a scene from the road wrapped around a structure from week one of a data-structures course. Name that shared design and the domain-flavored round loses its bite. Be just as clear about where the costume stops.
Common questions
Are Waymo coding problems really about self-driving?
Only on the surface. Prompts commonly arrive as a grid you navigate, a collision you reason about before coding, or a fleet reporting positions. Underneath sit standard structures: breadth-first search, interval merges, hashmaps, tries, two pointers. The costume adds a translation step where you extract the structure from the story, and that step is deliberately part of the test. Prepare the fundamentals cold and rehearse the reduction rather than studying robotics theory.
How do I practice the translation drill?
For every driving-flavored prompt, force three moves in order: restate the scene in plain words, name the underlying structure out loud, and only then code it. A grid of drivable and blocked cells is a graph you flood-fill. Overlapping time windows are intervals you sweep after sorting. A chronological stream of per-car updates is a hashmap you overwrite. Saying the structure before you type keeps you from modeling physics the problem never wanted.
Do I need C++ or robotics math for the coding round?
On the reachable evidence, no. The coding screens read as language-agnostic, so use the language you are strongest in, and the machine-learning track's extra round is Python and NumPy centered rather than C++. The autonomous-vehicle stack leans on C++ and heavy math as a job, but that is team-dependent and not a documented gate on the general coding round. Center clean, standard DS&A and the story-to-structure reduction.
Key Takeaways
- ✓Waymo dresses Google-grade DS&A as driving scenes. The costume front-loads a translation step: read the collision, occupancy, or trajectory story, name the graph, sweep, or hashmap under it, then code the ordinary solution. Naming the structure aloud before you type is the whole method.
- ✓The occupancy-grid reach count is a breadth-first search with a step budget. Mark and count each cell on enqueue so nothing is double-counted, stop expanding at the budget depth, and use a plain queue rather than a heap because every move costs the same.
- ✓Overlapping detection windows are Merge Intervals. Sort by start, sweep once, and fuse with an at-or-before test so touching windows connect, widening with the max of the two ends so a nested window never shrinks the span.
- ✓The fleet tracker is a hashmap keyed by car, overwriting on a chronological stream, then emitted in sorted id order. The reported escalation bounds the history to k positions per car, turning each value into a deque, so build the clean base case first and keep it easy to extend.
Waymo interview guideKnow what Waymo asks before you walk in.
9 coding · 3 system design · 15 behavioral questions
Get their questions first.
InterviewLegend is independent and not affiliated with or endorsed by any company it covers.