Maximum team performance

Write codeHard35 min

Your task

You have n engineers each with a speed and an efficiency. Pick at most k of them to form a team. The team's performance is (sum of chosen speeds) multiplied by (the minimum efficiency among the chosen). Return the maximum possible performance. (No modulo, values are small enough.) 1 <= k <= n.

Examples

max_performance(speed: list[int], efficiency: list[int], k: int) -> int
Example 1
Inputmax_performance([2, 10, 3, 1, 5, 8], [5, 4, 3, 9, 7, 2], 2)
Output60