Pair Camera Frames With Lidar Sweeps Within a Tolerance

Last updated: November 29, 2026

Quick Overview

Given sorted camera timestamps and sorted lidar sweep timestamps, pair as many camera frames as possible with a lidar sweep whose timestamp differs by at most tol milliseconds, using each sweep at most once.

Applied Intuition
Coding & Algorithms
Software Engineer
Applied Intuition
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Easy

0

0

0 solved


Given sorted camera timestamps and sorted lidar sweep timestamps, pair as many camera frames as possible with a lidar sweep whose timestamp differs by at most tol milliseconds, using each sweep at most once.

Sensor fusion and log replay tooling at Applied Intuition constantly line up streams that run at different rates. This question checks whether you can justify a two-pointer greedy instead of reaching for a nested loop or a matching algorithm.

What the Interviewer Expects
  • Exploit that both lists are sorted
  • Advance the pointer whose element can never match anything later
  • Argue why the greedy gives the maximum number of pairs
  • Return the actual pairs, not just a count
  • Run in linear time
Key Topics to Cover
two pointers
greedy matching
sorted arrays
sensor synchronization
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you instead pick the closest sweep for each frame when sweeps can be reused?
  • What if clocks drift so the tolerance should grow over the log?
  • How would you do this on two unbounded live streams?
  • How would you report frames that had no match for a data-quality dashboard?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Two sorted lists of integer milliseconds and a tolerance. Each lidar sweep can be paired once. Goal: maximize the number of pairs and return them as (camera_ts, lidar_ts)....

High-Level Design

Keep pointers i (camera) and j (lidar). If the two are within tolerance, pair them and advance both. If the sweep is older than camera - tol, it cannot match this frame or any later one, so drop it....


Submit Your Answer
Markdown supported

Related Questions