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
November 29, 20260
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
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
- 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 ProblemsSample Answer
Requirements
on_message(topic, t)for every publish, high frequency, must be cheap.unhealthy(now)returns topics whose rate over the lastwindowseconds is belowtolerance * 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...