Skip to content

Commit cc0d6d9

Browse files
committed
Create README - LeetHub
1 parent 1329bd7 commit cc0d6d9

File tree

1 file changed

+32
-0
lines changed
  • 2244-minimum-rounds-to-complete-all-tasks

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<h2><a href="https://leetcode.com/problems/minimum-rounds-to-complete-all-tasks/">2244. Minimum Rounds to Complete All Tasks</a></h2><h3>Medium</h3><hr><div><p>You are given a <strong>0-indexed</strong> integer array <code>tasks</code>, where <code>tasks[i]</code> represents the difficulty level of a task. In each round, you can complete either 2 or 3 tasks of the <strong>same difficulty level</strong>.</p>
2+
3+
<p>Return <em>the <strong>minimum</strong> rounds required to complete all the tasks, or </em><code>-1</code><em> if it is not possible to complete all the tasks.</em></p>
4+
5+
<p>&nbsp;</p>
6+
<p><strong class="example">Example 1:</strong></p>
7+
8+
<pre><strong>Input:</strong> tasks = [2,2,3,3,2,4,4,4,4,4]
9+
<strong>Output:</strong> 4
10+
<strong>Explanation:</strong> To complete all the tasks, a possible plan is:
11+
- In the first round, you complete 3 tasks of difficulty level 2.
12+
- In the second round, you complete 2 tasks of difficulty level 3.
13+
- In the third round, you complete 3 tasks of difficulty level 4.
14+
- In the fourth round, you complete 2 tasks of difficulty level 4.
15+
It can be shown that all the tasks cannot be completed in fewer than 4 rounds, so the answer is 4.
16+
</pre>
17+
18+
<p><strong class="example">Example 2:</strong></p>
19+
20+
<pre><strong>Input:</strong> tasks = [2,3,3]
21+
<strong>Output:</strong> -1
22+
<strong>Explanation:</strong> There is only 1 task of difficulty level 2, but in each round, you can only complete either 2 or 3 tasks of the same difficulty level. Hence, you cannot complete all the tasks, and the answer is -1.
23+
</pre>
24+
25+
<p>&nbsp;</p>
26+
<p><strong>Constraints:</strong></p>
27+
28+
<ul>
29+
<li><code>1 &lt;= tasks.length &lt;= 10<sup>5</sup></code></li>
30+
<li><code>1 &lt;= tasks[i] &lt;= 10<sup>9</sup></code></li>
31+
</ul>
32+
</div>

0 commit comments

Comments
 (0)