Untitled

mail@pastecode.io avatar
unknown
python
6 months ago
474 B
5
Indexable
Never
def minTime(start, end):
    process_time = []
 
    for i in range(len(start)):
        process_time.append((start[i], 1))
        process_time.append((end[i], -1))
 
    sorted_process_time = sorted(process_time, key=lambda x: (x[0], -x[1]))
 
    min_cores = 0
    total_cores = 0
    for i in range(len(sorted_process_time)):
        total_cores += sorted_process_time[i][1]
        min_cores = max(min_cores, total_cores)
 
    # Return the answer
    return min_cores