← Back to all recaps

Waymo VO Problem: When Does Road Coverage First Become Complete?

4 min read

Waymo Interview Recap

Waymo interview problems often have a very recognizable pattern: the surface statement does not look too intimidating, but if you follow the first intuitive idea too literally, you can end up building a solution that feels locally reasonable and globally unsafe.

This problem is a good example.

A more Waymo-style way to describe it is:

the system monitors a target stretch of road represented by a closed interval [roadStart, roadEnd].
Meanwhile, it receives a sequence of observed road segments, each also represented as a closed interval [segmentStart, segmentEnd].

These segments arrive one by one, in fixed order, and cannot be reordered.

The question is:

after which segment does the union of all observed coverage inside the target road fully contain the entire target interval for the first time?

If the target road is never fully covered, return -1.


The easiest way to misread the problem

A very common first instinct is:

  • every time a new interval arrives
  • merge all intervals again
  • then check whether the target road is fully covered

That certainly works in principle, but once the number of intervals grows, repeatedly re-merging everything becomes too expensive.

And in an interview, this is exactly where you are likely to get asked:

can we do better than re-merging everything after every new segment?

The most important complication is not interval merging by itself. It is this:

the arrival order is fixed, so sorting is not allowed.

That immediately kills many otherwise natural offline ideas.


The right clarification questions matter

This problem is especially good for early clarification, because a few small details have a big effect on the solution model.

Typical useful questions are:

  • are the intervals closed
  • can coordinates be negative
  • can a segment lie partially or fully outside the target road

The crucial clarification is usually:

segments may extend outside the target road, and only the intersection with the target interval matters.

That means the part outside the road is irrelevant. Only the overlap with [roadStart, roadEnd] contributes to the answer.

Once that is established, the state you maintain becomes much cleaner.


Why “just keep extending the current right boundary” is not robust

A tempting lighter-weight idea is:

  • maintain the farthest point currently covered continuously
  • if a new interval attaches, extend rightward
  • stop once the right boundary reaches the target end

This works on nicely ordered inputs, but it has a structural weakness:

it assumes useful intervals arrive in an order that supports one-directional extension.

In reality, the order is fixed and may be messy.

For example:

  • target road: [0, 100]
  • incoming segments: [50, 60], [0, 10], [10, 50]

If you only track a single currently extendable boundary, the first segment looks useless from the left edge, the second only gets you to 10, and only the third suddenly closes the gap.

That tells you something important:

  • a segment that looks unhelpful now may become essential later
  • so throwing away anything that does not extend the current frontier is unsafe

Therefore this is not a one-boundary greedy problem.


The stable model: maintain the merged covered intervals dynamically

The robust way to think about the problem is as an online dynamic interval-merging task.

Every time a new segment arrives:

  1. clip it to the target road
  2. merge it into the current set of already covered disjoint intervals

The key is that you do not maintain all historical raw intervals. You maintain:

the current disjoint merged intervals representing actual covered portions of the target road

That solves the ordering issue, because:

  • segments that are not immediately useful are still preserved if they cover valid road portions
  • future segments can connect them into larger merged blocks

So the maintained state is the merged result, not the raw input history.


Why clipping first matters

This step is easy to gloss over, but it is worth stating explicitly in an interview.

If an incoming segment lies:

  • fully outside the target road
  • or only partly overlaps it

then the only relevant part is its intersection with the target road.

So for each segment, you can compute:

  • left boundary = max(segmentStart, roadStart)
  • right boundary = min(segmentEnd, roadEnd)

If the clipped left side is greater than the clipped right side, that segment contributes nothing and can be ignored.

This keeps every later operation focused only on meaningful coverage.


The core of dynamic merging

Assume the current covered state is stored as a set of disjoint intervals ordered by start.

When a new effective segment arrives, you want to:

  • look left for an interval that overlaps or touches it
  • continue absorbing all intervals to the right that overlap or touch it
  • form one merged interval
  • write that interval back into the structure

Because the intervals are closed, endpoint-touching intervals should count as connected coverage. For example:

  • [0, 10]
  • [10, 20]

already form continuous coverage and should merge.

That is why the merge condition is not just strict overlap, but overlap-or-touch.

This is what makes the problem feel more like an online systems problem than a textbook offline merge-intervals exercise.


When can we return the answer?

The problem asks:

at what index does complete coverage happen for the first time?

So after each insertion and merge, the only thing you need to check is whether there exists a merged interval whose:

  • left endpoint is at or before roadStart
  • right endpoint is at or after roadEnd

Once that happens, the current segment index is the answer.

There is no need to compute total covered length.

Even if the total length appears sufficient, there may still be gaps. What matters is whether the merged state now contains one continuous block spanning the whole target interval.


Why this is better than full re-merge every time

If you sort and merge all historical intervals after every new segment, the cost grows quickly.

If instead you maintain:

  • the already merged disjoint intervals

then each new segment only interacts with nearby intervals in the ordered structure.

That is the real optimization: you keep the state in compressed merged form at all times.

A natural implementation vehicle is:

  • an ordered map
  • a balanced BST
  • or any structure that can find neighboring intervals by start point

In an interview, the exact library choice matters less than making the state-maintenance idea completely clear.


Typical follow-up directions

Follow-up 1: what if there are millions of incoming segments?

This is usually checking whether your method still depends on full recomputation.

If you have already switched to maintaining merged disjoint intervals, the answer becomes natural:

  • still online
  • no full re-merge
  • each new segment only affects local neighbors in the merged structure

Follow-up 2: what if reordering were allowed?

Then the problem collapses into a classic interval coverage problem.

Once sorting is allowed, you can:

  • sort by start
  • greedily verify left-to-right coverage

with complexity around O(n log n).

Follow-up 3: what if the problem becomes two-dimensional?

This is a common pressure question.

Once intervals become rectangles, the problem is no longer simple interval merging. Complexity grows significantly.

A natural extension direction would be:

  • sweep line
  • segment tree

In other words, reduce the 2D coverage logic into a 1D dynamic maintenance problem during the sweep.

You do not need to fully solve the 2D version, but you should show that you understand why the 1D solution does not transfer directly.


What Waymo is really testing here

This looks like an interval problem, but it is really testing whether you know how to maintain evolving state online.

The core is not:

  • do you know interval merge mechanics

The core is:

  • do you realize the order is fixed and sorting is forbidden
  • do you avoid full recomputation
  • do you maintain the merged effective state instead of the raw history

That is a very common shape for Waymo-style questions:

  • the setting feels operational
  • the first instinct is often not strong enough
  • the accepted solution comes from more disciplined state maintenance

So this is not about who has memorized more problems. It is about who can recognize that this is an online coverage problem, not a static interval problem.


Final Takeaway

The most important thing to remember is not just “which segment finally covers the road,” but the structure underneath it:

  • the input order is fixed
  • sorting is not allowed
  • and we still need to detect complete coverage online

Once that is recognized, the stable solution is no longer a single-boundary greedy extension. It becomes:

  • clip each incoming segment to the target road
  • merge it into the current disjoint covered intervals
  • check whether the merged state now contains one block spanning the target interval

If you are preparing for Waymo or similar VO rounds, this category of “online interval-state maintenance” is very worth practicing. It exposes very quickly whether someone is applying templates or actually understanding the problem structure.


🚀 oavoservice: Stable Support for Your Waymo VO

If you have upcoming Waymo, Google, Apple, LinkedIn, or Amazon VO rounds, practicing these real question patterns and follow-up structures in advance can make a huge difference.

We provide:

Real-time big tech VO support — coding, BQ, and system design assistance throughout
Real-question mock sessions — as close as possible to actual interview pacing
High-pressure follow-up training — not just the first answer, but staying stable under pushback
Long-form modeling practice — helping you quickly translate business-flavored statements into solvable structures

If you want feedback that feels close to the real interview environment, feel free to reach out.

👉 Add WeChat now: Coding0201

Telegram: @OAVOProxy
Gmail: [email protected]