Tesla·Machine Learning Engineer·Technical Phone Screen
- Given a batch of 2D waypoint trajectories with shape [B, N, 2], compute for each batch item and each waypoint the remaining path length from that waypoint to the end of the trajectory. The output should have shape [B, N], where each value is the suffix sum of Euclidean distances between consecutive waypoints. Must run in O(B·N) time and handle edge cases like a single waypoint.
“The suffix sum part clicked fast, you just iterate backwards and accumulate segment lengths.”