Find Joint Limit Violation Windows in a Humanoid Trajectory

Last updated: November 29, 2026

Quick Overview

Given a time-ordered list of (timestamp, joint angle) samples and a joint's soft limits [lo, hi], return every maximal contiguous window where the angle is outside the limits, with its start time, end time and peak excess. Optionally ignore windows shorter than a minimum number of samples.

Figure AI
Coding & Algorithms
Software Engineer
Figure AI
November 29, 2026
Software Engineer
Phone Screen
Coding & Algorithms
Easy

0

0

0 solved


Given a time-ordered list of (timestamp, joint angle) samples and a joint's soft limits [lo, hi], return every maximal contiguous window where the angle is outside the limits, with its start time, end time and peak excess. Optionally ignore windows shorter than a minimum number of samples.

A warm-up in the style of a Figure AI phone screen for controls or robot software roles, framed around checking logged trajectories before they are replayed on hardware. The interviewer is checking clean single-pass logic, careful run boundaries, and whether you think about what a safety reviewer actually needs from the output.

What the Interviewer Expects
  • Solves it in one linear pass without extra arrays
  • Handles a violation run that is still open at the end of the data
  • Treats both the lower and upper limit with one excess formula
  • Explains why peak excess matters more than a boolean flag for review
  • Tests empty input and a run of length one
Key Topics to Cover
Run-length scanning
Streaming state machines
Joint limits
Edge cases at boundaries
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 do this for 30 joints streamed at 1 kHz without storing the whole log?
  • What changes if you want hysteresis so a signal hovering at the limit does not create dozens of tiny windows?
  • How would you also flag velocity limit violations computed from the same samples?
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

Input: samples [(t, angle)] sorted by time, limits lo < hi, and min_len (default 1). Output: list of (start_t, end_t, peak_excess) for each maximal run of out-of-limit samples, where excess is...

High-Level Design

Walk the samples once with a tiny state machine: outside or inside. Define excess = max(lo - a, a - hi, 0), which is positive exactly when the sample violates either limit. Entering a violation ...


Submit Your Answer
Markdown supported

Related Questions