Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing

Balanced team assignment by workload

Python data engineering interview problem. Difficulty: advanced. Pattern: Sorting. About 20 minutes. Part of the Pro drill bank.

A shift planner has a list of task efforts and a number of workers. Work should be split so no worker is overloaded relative to the others.

Assign tasks to workers in a balanced way by workload.

Requirements

  • Every task is assigned.
  • Balance is about total effort, not task count alone.

Constraints

  • efforts: task sizes.
  • workers: number of workers.
  • One worker gets everything if workers = 1.

Examples

Input: assign_tasks([4, 2, 7, 1], 2) Output: 7 This input follows the stated rules and produces this output.

Topics: lakebench, python, greedy.

More Python interview questions · All interview problems · Learn data engineering

advanced

Balanced team assignment by workload

Interview-style drill: Distribute a list of tasks with varying effort across a fixed number of workers to minimize the busiest worker's load.

Assign tasks to workers in a balanced way by workload.