Algorithm · Amazon · Medium
A server must execute a collection of requests. Each entry in an array gives the time needed for one request. Determine the smallest possible overall completion time while ensuring that no more than maxRequests requests run simultaneously. Requests may overlap in execution, but an individual request must remain whole. Return the minimum total time needed to finish every request. Input: requests: An integer array whose values specify request execution times. maxRequests: An…