Earliest Time a Moving Agent Enters the Ego Safety Radius
Last updated: November 29, 2026
Quick Overview
The ego vehicle and each nearby agent move with constant velocity in 2D. For each agent, compute the earliest time within a planning horizon at which its distance to the ego drops to a given safety radius, and return conflicting agents sorted by that time.
Nuro
November 29, 20260
0
0 solved
The ego vehicle and each nearby agent move with constant velocity in 2D. For each agent, compute the earliest time within a planning horizon at which its distance to the ego drops to a given safety radius, and return conflicting agents sorted by that time.
Collision checking is the inner loop of motion planning, and a robotaxi built on the Nuro Driver evaluates many candidate trajectories against many agents every cycle. The interviewer wants a closed-form solution in relative coordinates, a correct reading of the quadratic's roots, and awareness of numeric edge cases.
What the Interviewer Expects
- Move to relative position and velocity to reduce to one moving point
- Set up the quadratic |p + v t|^2 = r^2 and interpret its roots
- Handle already-in-conflict, zero relative velocity, and moving-apart cases
- Clip results to the horizon
- Discuss why real planners use swept shapes and sampled trajectories
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you handle agents modeled as oriented rectangles instead of circles?
- How do you extend this to piecewise-linear predicted trajectories?
- How would you prune thousands of agents before doing exact checks?
- How would prediction uncertainty change the safety radius?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Positions and velocities are 2D tuples, the radius already includes both footprints, and the horizon is in seconds. If the agent is already inside the radius the answer is 0. If it never comes within ...
High-Level Design
Let d = p1 - p2 and w = v1 - v2. The separation at time t is d + w t, so we solve , which is with , , $c = d \cdot d - r^...