Logo

Coding preview

Bad users tracker

What this preview is

About this preview

Bad users tracker is a easy quant coding problem on language knowledge in Cpp.

Unlock full access to getcracked

Join to unlock this problem, detailed solutions, and our complete library of quant finance interview prep.

What this C++ data-structure coding problem tests

This is an easy coding problem that asks you to implement a time-windowed request tracker in C++. It probes whether you can manage a sliding window of events, maintain aggregate counts per user, and crucially, evict stale data so memory does not grow without bound.

The core challenge is not algorithmic difficulty but rather careful bookkeeping: you must track requests by timestamp, count them within a 300-second window, identify users exceeding a threshold, and clean up expired entries as time advances. Strong solutions choose a data structure (such as a map of queues or a deque per user) that makes both insertion and expiration efficient and straightforward to reason about.

  • Sliding-window time-series tracking
  • Per-entity counters and aggregation
  • Lazy vs. eager garbage collection of stale state
  • Trade-offs between query time and memory overhead