Tap here to switch tabs
Problem
Submissions

Problem: Minimum Rounds to Complete All Tasks

med
30 min
Try to solve the Minimum Rounds to Complete All Tasks problem.

Statement

You are given an integer array tasks, where tasks[i] represents the difficulty level of a task. In each round, you can complete either 22 or 33 tasks of the same difficulty level.

Return the minimum number of rounds required to complete all tasks, or −1-1 if it is impossible to complete all the tasks.

Constraints:

  • 1≤1 \leq tasks.length ≤105\leq 10^5

  • 1≤1 \leq tasks[i] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Rounds to Complete All Tasks

med
30 min
Try to solve the Minimum Rounds to Complete All Tasks problem.

Statement

You are given an integer array tasks, where tasks[i] represents the difficulty level of a task. In each round, you can complete either 22 or 33 tasks of the same difficulty level.

Return the minimum number of rounds required to complete all tasks, or −1-1 if it is impossible to complete all the tasks.

Constraints:

  • 1≤1 \leq tasks.length ≤105\leq 10^5

  • 1≤1 \leq tasks[i] ≤109\leq 10^9