Synchronize Multi-Camera Clocks From Pairwise Offset Observations
Last updated: November 29, 2026
Quick Overview
Cameras at one incident report pairwise clock offsets (camera b's clock minus camera a's) one at a time. Support adding an observation, rejecting it if it contradicts earlier ones beyond a tolerance, and querying the offset between any two cameras.
Axon
November 29, 20260
0
0 solved
Cameras at one incident report pairwise clock offsets (camera b's clock minus camera a's) one at a time. Support adding an observation, rejecting it if it contradicts earlier ones beyond a tolerance, and querying the offset between any two cameras.
Axon Evidence can play several officers' videos side by side, which only works if each camera's clock is aligned to the others. This question tests weighted union-find with path compression, careful sign conventions, and consistency checking, a pattern that appears in real multi-sensor alignment.
What the Interviewer Expects
- Recognize weighted (potential) union-find
- Store each node's offset relative to its parent and compress paths correctly
- Derive the root-link offset formula without sign errors
- Detect contradictions within a tolerance when both cameras share a root
- Return None for unknown or unconnected cameras
- Near-constant amortized time per operation
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
- Observations are noisy measurements; how would you compute a best-fit set of offsets instead of first-wins?
- How would you add union by rank and does it matter here?
- How would you also model clock drift, where offset changes linearly with time?
- How would you pick one reference camera to display a unified timeline?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
add(a, b, offset) asserts clock_b minus clock_a equals offset. Return True if accepted (new info or consistent within tol), False if it contradicts. offset(a, b) returns clock_b minus clock_a if...
High-Level Design
Each component of cameras connected by observations forms a tree. Store diff[x] = clock_x - clock_parent(x). After find, each node points to its root and diff[x] is clock_x minus clock_root. The...