GRAB Hiring Off-Campus OA (2022) | Problem Minimum Rounds to Complete All Tasks

Question · Posted Jun 2026

Problem Statement You are given an integer array tasks, where tasks[i] represents the difficulty level of a task. In one round, you can complete either: Exactly 2 tasks of the same difficulty, or Exactly 3 tasks of the same difficulty. Return the minimum number of rounds required to complete all tasks. If it is impossible to complete all tasks following the rules, return -1. Example 1 Input tasks = [2,2,3,3,2,4,4,4,4,4] Output 4 Explanation Difficulty 2 → 3 tasks → 1 ...

The full answer & interview discussion are available to premium members.

Log in Create a free account