Question bank › Greedy
Dsa Greedy Medium

Allocate Tasks with Minimum Time Blocks

You are organizing a set of tasks that need to be completed across multiple time blocks. Each task has a specific duration and it can only take place in a single time block. Your goal is to assign the tasks to different time blocks in such a way that the longest time block is minimized. Input format: - The first line contains an integer k (1 ≤ k ≤ 50), the number of time blocks. - The second line contains k integers, representing the time available in each block. - The third line contains an integer n (1 ≤ n ≤ 1000), the number of tasks. - The fourth line contains n integers, representing the duration of each task. Output format: - Print a single integer, the minimized maximum time block used. Example: Input: 2 10 15 3 5 3 8 Output: 8

Key concepts

greedyschedulingarray

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.