Trains the technique from
LeetCode 1383Maximum Performance of a TeamThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A wind farm owns n turbines. Turbine i produces output[i] units of power and runs at a steadiness of steadiness[i].
A group is any non-empty selection of at most k turbines. Its rating is the total output of the turbines in it multiplied by the smallest steadiness among them.
Return the largest rating a group can reach. Because that number can be large, return it modulo 10^9 + 7.
Example 1
The first two turbines total 6 in output with a smallest steadiness of 5, a rating of 30. The last two total 10 with a smallest steadiness of 3, also 30. Nothing does better.
Example 2
Adding the second turbine lifts the output to 11 but drags the smallest steadiness down to 1, rating 11. The first turbine on its own rates 100, so the best group is smaller than the limit allows.
Example 3
Only one turbine may be taken. The first rates 10 and the second rates 100.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def max_performance(n: int, output: list[int], steadiness: list[int], k: int) -> int:public int maxPerformance(int n, int[] output, int[] steadiness, int k)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.