Problem · Queue
Get Active Requests Count
Learn this problemProblem statement
You are given an integer, requests which denotes the number of requests, and a list wait_time, where wait_time[i] denote the maximum wait time of the i'th request. The requests in the list are served from the first index to the last, and each request will be served for one second, then it is removed from the list (essentially, when you are at index 0, your current time is 0 seconds, then you spend 1 second serving request 0 and remove it from the list). Meanwhile, if some requests in the rest of the list to the right of the current request exceeds its wait time, then it is removed from the list as well. Return an array denoting how many active requests are present in the list each second.
Function
getActiveRequestsCount(requests: int, wait_time: int[]) → int[]Examples
Example 1
requests = 6wait_time = [5, 2, 2, 4, 7, 1]return = [6, 4, 2, 2, 1, 0]N/A for now 🤧
Will add once find it 😘
If you happen to know about it, pls feel free to tell me 🥂
You da best! 🧡
More Amazon problems
- Secure Maximum DeliveriesOA · Seen Jul 2026
- Find Median from Data StreamONSITE INTERVIEW · Seen Jul 2026
- Handwritten SigmoidPHONE SCREEN · Seen Jul 2026
- Handwritten SoftmaxPHONE SCREEN · Seen Jul 2026
- Koko Eating BananasONSITE INTERVIEW · Seen Jul 2026
- Loyal Customers Across Two DaysONSITE INTERVIEW · Seen Jul 2026
- Maximum System Memory CapacityOA · Seen Jul 2026
- Package Delivery SystemOA · Seen Jul 2026