ProdMatch
CompaniesCitiesRolesSign in

Companies

  • Google
  • Microsoft
  • Meta
  • Amazon
  • Apple
  • Atlassian
  • Nvidia
  • Oracle
  • See all 51 →

Cities

  • Bengaluru jobs
  • Hyderabad jobs
  • Pune jobs
  • Gurugram jobs
  • Noida jobs
  • Delhi NCR jobs
  • Mumbai jobs
  • Chennai jobs
  • Remote-India jobs

Roles

  • QA / SDET Engineers
  • Backend Engineers
  • Frontend Engineers
  • Full-stack Engineers
  • Data Analysts
  • Data Engineers
  • ML / AI Engineers
  • DevOps / SRE Engineers
  • All roles →

ProdMatch

  • About
  • Career guides
  • Compare
  • Salaries
  • Skills
  • DSA practice
  • Privacy
  • Terms
  • Sign in

© 2026 ProdMatch.ai · Built for India · DPDP Act 2023 compliant · Job data sourced from official company career pages.

Back to DSA
Greedymedium45 minPlatform Engineer

Build Greedy Load Rebalancer

Platform Engineer signal: greedy proof + sorting in a build graph scheduler context. This is a ProdMatch-owned platform engineer drill, framed as a April 2026 BrowserStack Developer Platform simulation, not a copied platform question.

Company context

BrowserStack · Developer Platform

Freshness

April 2026

Product surface

build graph scheduler

ProdMatch interview simulation based on product-team patterns; not a claim of a real company question.

Question

Rebalance targets across shards for build graph scheduler. Each move has a cost equal to distance between shards. Compute minimum cost to make shard loads differ by at most one.

Input

  • Array of shard loads.

Output

  • Minimum movement cost.

Constraints

  • 1 <= shards <= 200000
  • Total load <= 1e12

Concepts

  • build DAGs
  • tenant quotas
  • artifact caching
  • greedy proof
  • sorting
  • load balancing

loads [0,3,0] -> move one unit left and one right, cost=2

Approach

Try framing your own approach first. The 30 seconds you think before peeking is where learning happens.

Clean Solution

Reveal the approach first.

How well did you understand?

Your rating tunes when this problem shows up again.

Common Mistakes

  • A greedy idea without a proof may fail hidden cases.
  • Do not mutate sorted keys in a way that breaks ordering.

Next Similar Problems

Artifacts Greedy Load RebalancermediumTenancy Greedy Load RebalancerhardPackages Greedy Load Rebalancermedium