Facebook | Min Time to Execute Tasks

16972
Oct 29, 2015
Aug 19, 2019

Given a set of tasks, and int k, which is the waiting time between two same tasks. Calculate the min total execution time if you are allowed to rearrange the tasks. Assume the execution for each individual task is 1.

Example:

Input: tasks = [A A B], k = 1
Output: 3
Explanation:
Without rearrangement, the execution time would be 4:

    A wait A B
    
    1  1   1 1

With rearrangement, the execution time would be 3:

    A B A
    
    1 1 1

Related problems:

Comments (11)