Get Minimum Time ⏰
There are n services numbered from 1 to n in a system, and there are m requests to be processed.
The service in which the ith request is cached is denoted by cache[i], for all 1 <= i <= m. For any request, if the request is processed from a cache, then it takes 1 unit of time.
Otherwise, it takes 2 units of time.
Different services can process different requests simultaneously, but one service can only process one request at a time. Find the minimum time to process all the requests by allocating each request to a service.
Complete the function getMinTime in the editor.
getMinTime has the following parameters:
int n: the number of services in the systemint cache[m]: the service in which the request is cached
Returns
int: the minimum time required to process all requests
1Example 1
Constraints
Limits and guarantees your solution can rely on.
Unknown for now 👉👈