Practice Minimum Rounds to Complete All Tasks
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given a 0-indexed integer array tasks, where tasks[i] represents the difficulty level of a task. In each round, you can complete either 2 or 3 tasks of the same difficulty level. Return the minimum rounds required to complete all the tasks, or -1 if it is not possible to complete all the tasks. Example 1: Example 2: Constraints: Note: This question is the same as 2870: Minimum Number of Operations to Make Array Empty.
Source: Minimum Rounds to Complete All Tasks on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
tasks = [2,2,3,3,2,4,4,4,4,4]
4
# Example 2
tasks = [2,3,3]
-1
Constraints
Related LeetCode Problems
Practice more problems similar to Minimum Rounds to Complete All Tasks.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.