Find Requests in Queue

Problem Overview

  • Given wait[i] for n queued customer requests, report how many requests remain in the queue at each second until it becomes empty.
  • Input: int wait[n]; Output: array of counts per second; Constraints: 1 ≤ n ≤ 1e5, 1 ≤ wait[i] ≤ 1e5.
  • Context: AWS server handles requests FIFO; first processing at time 0; requests expire when time equals wait[i].
  • Real-world domain: queue management in cloud services (Amazon Web Services).
  • This Amazon interviews coding interview problem is a common 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: