Dropped Requests

Problem Overview

  • Given ordered request times, count requests dropped by a throttling gateway.
  • Limits: max 3 per second, 20 per any 10-second window [T-9..T], 60 per minute [T-59..T]; dropped requests still count later; multiple violations count once.
  • Input: list of integers; Output: total dropped (int); Constraints: n ≤ 1e6, times ≤ 1e9.
  • Real-world: Amazon Prime Day traffic control for a transaction system.
  • An Amazon coding interview problem and interview question from Amazon interviews.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: