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
Greedyhard70 minFrontend Engineer

Offline Greedy Load Rebalancer

Frontend Engineer signal: greedy proof + sorting in a offline draft sync context. This is a ProdMatch-owned frontend engineer drill, framed as a May 2026 Dream11 Web Platform simulation, not a copied platform question.

Company context

Dream11 · Web Platform

Freshness

May 2026

Product surface

offline draft sync

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

Question

Rebalance drafts across shards for offline draft sync. 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

  • render scheduling
  • state graphs
  • virtualization
  • 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

Timeline Greedy Load RebalancermediumAutocomplete Greedy Load RebalancermediumCanvas Greedy Load Rebalancerhard