FastPrepMinimize Absolute Difference of Server Loads
Problem · Dynamic Programming

Minimize Absolute Difference of Server Loads

MediumGoogle logoGoogleINTERNOA
See Google hiring insights

Problem statement

There are some processes that need to be executed. Amount of a load that process causes on a server that runs it, is being represented by a single integer. Total load caused on a server is the sum of the loads of all the processes that run on that server. You have at your disposal two servers, on which mentioned processes can be run. Your goal is to distribute given processes between those two servers in the way that, absolute difference of their loads will be minimized.

The problem statement continues
Pro

Examples

Example 1

loads = [1, 2, 3, 4, 5]return = 1

We can distribute the processes with loads [1, 2, 4] to the first server and [3, 5] to the second one, so that their total loads will be 7 and 8, respectively, and the difference of their loads will be equal to 1.

2 original screenshots from the interview report
Pro
FastPrep Pro
Reported in 1 Google interview this week

Unlock this recently reported problem

FastPrep Pro gives you full access to interview problems reported within the last week.

  • Full problem statement and constraints
  • Worked examples, explained
  • Guided hints and editorial
  • Run your code on real test cases
$8.25/month

$99 billed yearly — or $19 month-to-month. Cancel anytime.

Free plan — 2 of 2 free unlocks used this week
CodePython 3
Run and Submit unlock with Pro
FastPrep Pro
Reported in 1 Google interview this week

Unlock this recently reported problem

FastPrep Pro gives you full access to interview problems reported within the last week.

  • Full problem statement and constraints
  • Worked examples, explained
  • Guided hints and editorial
  • Run your code on real test cases
$8.25/month

$99 billed yearly — or $19 month-to-month. Cancel anytime.

Free plan — 2 of 2 free unlocks used this week