Detect Stalled Pub-Sub Topics on a Robot Middleware Bus

Last updated: November 29, 2026

Quick Overview

Build a monitor that receives (topic, timestamp) for every message published on the robot's middleware bus and, when asked, reports which topics are publishing below a tolerance fraction of their expected rate over a sliding time window.

Figure AI
Coding & Algorithms
Software Engineer
Figure AI
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


Build a monitor that receives (topic, timestamp) for every message published on the robot's middleware bus and, when asked, reports which topics are publishing below a tolerance fraction of their expected rate over a sliding time window.

A humanoid's autonomy stack depends on many sensor and state topics, and a camera that silently drops from 30 Hz to 5 Hz can make a learned policy behave badly long before anything crashes. In a Figure AI middleware screen, this tests sliding window data structures and practical judgement about startup, silence, and noise.

What the Interviewer Expects
  • Keeps per-topic deques and evicts old timestamps lazily
  • Flags topics that never published at all
  • Avoids false alarms during a startup grace period
  • Explains the memory cost and an O(1) alternative
  • Discusses where the timestamps come from (publish vs receive time)
Key Topics to Cover
Sliding windows
Deques
Health monitoring
Middleware
Startup grace periods
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
  • At 1 kHz across 200 topics the deques are large; how would you do it in O(1) memory per topic?
  • How would you also detect bursty topics whose average is fine but whose gaps exceed a deadline?
  • Should a stalled camera topic trigger a safe stop, a degraded mode, or only an alert? Who decides?
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
  • on_message(topic, t) for every publish, high frequency, must be cheap.
  • unhealthy(now) returns topics whose rate over the last window seconds is below tolerance * expected_hz.
  • A topic tha...
High-Level Design

One deque of timestamps per topic. Appends are O(1); eviction pops from the left while the oldest timestamp is outside (now - window, now]. The rate is len(deque) / window. Track first-seen time f...


Submit Your Answer
Markdown supported

Related Questions