Skip to content

Commit e89c92e

Browse files
committed
Create README - LeetHub
1 parent a08068b commit e89c92e

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<h2><a href="https://leetcode.com/problems/maximum-performance-of-a-team/">1383. Maximum Performance of a Team</a></h2><h3>Hard</h3><hr><div><p>You are given two integers <code>n</code> and <code>k</code> and two integer arrays <code>speed</code> and <code>efficiency</code> both of length <code>n</code>. There are <code>n</code> engineers numbered from <code>1</code> to <code>n</code>. <code>speed[i]</code> and <code>efficiency[i]</code> represent the speed and efficiency of the <code>i<sup>th</sup></code> engineer respectively.</p>
2+
3+
<p>Choose <strong>at most</strong> <code>k</code> different engineers out of the <code>n</code> engineers to form a team with the maximum <strong>performance</strong>.</p>
4+
5+
<p>The performance of a team is the sum of their engineers' speeds multiplied by the minimum efficiency among their engineers.</p>
6+
7+
<p>Return <em>the maximum performance of this team</em>. Since the answer can be a huge number, return it <strong>modulo</strong> <code>10<sup>9</sup> + 7</code>.</p>
8+
9+
<p>&nbsp;</p>
10+
<p><strong>Example 1:</strong></p>
11+
12+
<pre><strong>Input:</strong> n = 6, speed = [2,10,3,1,5,8], efficiency = [5,4,3,9,7,2], k = 2
13+
<strong>Output:</strong> 60
14+
<strong>Explanation:</strong>
15+
We have the maximum performance of the team by selecting engineer 2 (with speed=10 and efficiency=4) and engineer 5 (with speed=5 and efficiency=7). That is, performance = (10 + 5) * min(4, 7) = 60.
16+
</pre>
17+
18+
<p><strong>Example 2:</strong></p>
19+
20+
<pre><strong>Input:</strong> n = 6, speed = [2,10,3,1,5,8], efficiency = [5,4,3,9,7,2], k = 3
21+
<strong>Output:</strong> 68
22+
<strong>Explanation:
23+
</strong>This is the same example as the first but k = 3. We can select engineer 1, engineer 2 and engineer 5 to get the maximum performance of the team. That is, performance = (2 + 10 + 5) * min(5, 4, 7) = 68.
24+
</pre>
25+
26+
<p><strong>Example 3:</strong></p>
27+
28+
<pre><strong>Input:</strong> n = 6, speed = [2,10,3,1,5,8], efficiency = [5,4,3,9,7,2], k = 4
29+
<strong>Output:</strong> 72
30+
</pre>
31+
32+
<p>&nbsp;</p>
33+
<p><strong>Constraints:</strong></p>
34+
35+
<ul>
36+
<li><code>1 &lt;= k &lt;= n &lt;= 10<sup>5</sup></code></li>
37+
<li><code>speed.length == n</code></li>
38+
<li><code>efficiency.length == n</code></li>
39+
<li><code>1 &lt;= speed[i] &lt;= 10<sup>5</sup></code></li>
40+
<li><code>1 &lt;= efficiency[i] &lt;= 10<sup>8</sup></code></li>
41+
</ul>
42+
</div>

0 commit comments

Comments
 (0)