Minimum Drain Rate for a Distributed Backlog

A distributed job system runs n partitions, where partition i holds piles[i] pending jobs. Before a maintenance window opens, the control plane must publish one integer drain rate, k, measured in jobs per round. During each round the dispatcher selects exactly one non-empty partition and completes up to k jobs from it. Two partitions never drain in the same round.

Find the smallest positive integer k that empties every partition within h rounds.

Partition order does not matter. A rate is feasible when the sum of ceil(piles[i] / k) over all partitions is at most h. The input limits guarantee that at least one feasible rate exists.

Examples
Input: [[3,6,7,11],8]
Output: 4
Hints
Related Problems

Minimum Drain Rate for a Distributed Backlog

A distributed job system runs `n` partitions, where partition `i` holds `piles[i]` pending jobs. Before a maintenance window opens, the control plane must publish one integer drain rate, `k`, measured in jobs per round. During each round the dispatcher selects exactly one non-empty partition and completes up to `k` jobs from it. Two partitions never drain in the same round.