Get Active Requests Count

Problem Overview

  • Determine the number of active requests at each second as a queue is processed.
  • Input: integer requests count and list wait_time[i]; Output: array of counts per second until all requests are removed.
  • Each second, serve the next request for one second; remove any remaining request that exceeds its wait time.
  • Models a server request queue with per-request timeouts.
  • From Amazon interviews; a coding interview problem and interview question.

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: