Given engineers with speed and efficiency, choose up to k engineers to maximize speed sum multiplied by the minimum efficiency among selected engineers. The optimal solution sorts by efficiency and uses a max heap of speeds.
speed and efficiency arrays, k max team size
maximum performance modulo 1,000,000,007 if required by judge
Example 1:
Input:
speed = [2,10,3,1,5,8] efficiency = [5,4,3,9,7,2] k = 2
Output:
60
Explanation:
The best team gives performance 60.
Example 2:
Input:
speed = [2,10,3,1,5,8] efficiency = [5,4,3,9,7,2] k = 3
Output:
68
Explanation:
With three engineers, the best performance increases to 68.