Back to problems

Shard Rebalancing

Algorithm · OpenAI · Hard

Design a shard coordinator for a distributed key-value store that partitions data across multiple shards. Each shard is represented as a string " : : ", where start and end are inclusive integer boundaries defining the key range the shard owns. The system enforces a cap limit on the maximum number of shards allowed to cover any single key. Your task is to implement the rebalance(limit, shards) method, which adjusts overlapping intervals that violate the limit and closes any…

Checking your access…