Match Camera Frames to the Nearest Lidar Sweep Timestamp
Last updated: November 29, 2026
Quick Overview
Given sorted camera frame timestamps and sorted lidar sweep timestamps, return for each camera frame the index of the closest lidar sweep within a tolerance, or -1 if none is close enough.
Zoox
November 29, 20260
0
0 solved
Given sorted camera frame timestamps and sorted lidar sweep timestamps, return for each camera frame the index of the closest lidar sweep within a tolerance, or -1 if none is close enough.
Zoox fuses cameras, lidar and radar that run at different rates, so pairing measurements by time is a daily concern for perception and data-pipeline engineers. A phone screen uses this to check clean two-pointer reasoning, careful tie handling and attention to the empty-input cases that break log tooling.
What the Interviewer Expects
- Clarifies tie-breaking and whether the tolerance is inclusive
- Uses the sortedness of both streams for a linear two-pointer pass
- Handles an empty lidar stream and frames far outside any sweep
- States O(n + m) time and O(1) extra space beyond output
- Mentions binary search as an alternative when streams are not processed together
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 a stream that arrives online instead of as full lists?
- What changes if each sweep has a start and end time rather than a single stamp?
- How would you detect clock drift between the two sensors from these matches?
- Should two camera frames be allowed to share one sweep?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Inputs: camera_ts and lidar_ts, both sorted ascending (microseconds or milliseconds, same clock). Output: list of the same length as camera_ts, each entry the index of the nearest sweep if `|dif...
High-Level Design
Because both lists are sorted, the best sweep for camera frame k+1 is never earlier than the best sweep for frame k. So a single pointer j into the lidar list only moves forward. For each frame, adv...