Align Two Vehicle Trajectories With Banded Dynamic Time Warping
Last updated: November 29, 2026
Quick Overview
Given a recorded ego trajectory and a simulated one as lists of 2D poses sampled at different rates, compute the minimum dynamic time warping cost under a Sakoe-Chiba band of width w and return the alignment path.
Applied Intuition
November 29, 20260
0
0 solved
Given a recorded ego trajectory and a simulated one as lists of 2D poses sampled at different rates, compute the minimum dynamic time warping cost under a Sakoe-Chiba band of width w and return the alignment path.
Comparing a re-simulated drive against the original log is central to Applied Intuition's log-based testing, and the two rarely have matching sample times. The interviewer checks a 2D DP with a constraint window, reconstruction, and complexity reasoning for long logs.
What the Interviewer Expects
- Define the DTW recurrence and its base case
- Restrict cells to a band around the rescaled diagonal
- Treat cells outside the band as infinite cost
- Backtrack to recover the alignment path
- Cut runtime from O(nm) to about O(n w)
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 reduce memory if only the cost is needed?
- Why can DTW hide a timing regression that matters for safety, and what would you report alongside it?
- How would you make the metric invariant to a constant spatial offset?
- How would you choose the band width automatically?
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 a (n poses) and b (m poses), each (x, y). Cost of matching two poses is Euclidean distance. Alignment must start at (0,0), end at (n-1,m-1) and be monotone. Band: for row i only colum...
High-Level Design
Classic DTW: with and other border cells infinite. Because the rates differ, the band follows the rescaled diagonal rath...
Submit Your Answer
Applied Intuition Software Engineer Interview Guide
Interview process, tips, and preparation timeline