GO TO A SECTION

↑ ↓ to navigate · Enter to openExplore all sections →
FDEInterviews logo
← Coding & DSA / 62
easyOpenAIAnthropicDatadog

Maintain a sliding-window average over a stream of metrics, like tokens/sec.

A dashboard needs the average tokens/sec over the last N seconds, updated on every sample, forever. The warm-up that screens whether you evict by time and keep a running sum instead of re-summing the window each call.

Updated Aug 2026 · Grounded in real Forward Deployed Engineer interview loops and written to a senior-engineer editorial bar.

A dashboard needs the average tokens/sec over the last N seconds, updated on every sample, forever. The warm-up that screens whether you evict by time and keep a running sum instead of re-summing the window each call.

20 answers per topic instead of 10, plus saved progress and bookmarks · no cardor unlock all 548 remaining answers · ₹2,000 / $25

Every answer, concept and course, every paper breakdown, all published video lessons, hands-on FDE Lab missions, Premium PDF guides and companion files, the full practice-test bank and work-sample downloads. Referral Premium excludes guide PDFs and their companion files.

6 months · One payment · No auto-renewal

Study alongside free video lessons.

Keep practising

FEDITOR'S NOTE

The fork in the road is count-window versus time-window. Many candidates build a fixed-size deque (last N samples), which is wrong when samples arrive irregularly, the metric you actually want is the last N seconds. The other tell is re-summing the whole window on every read, turning an O(1) operation into O(N) and melting under a high-frequency stream. Running sum plus time-based eviction is the answer.

DISCUSSION · 0

No comments yet — be the first to share your approach.