sacks[i] is the weight of sack i in kilograms. At most splits times you may take any sack and pour it into two new sacks, each holding a positive whole number of kilograms (a 5 kg sack, say, can become 1 and 4 or 2 and 3).
The movers complain about the heaviest sack. Return the smallest possible weight of the heaviest sack after the splits.sacks=[10], splits=3 → 3
Three splits give four sacks, for example 3, 3, 2, 2, so the heaviest weighs 3. Less is impossible: four sacks of 2 hold only 8.
sacks=[7, 3, 5], splits=2 → 4
Split 7 into 4 and 3 and split 5 into 4 and 1: the sacks are 4, 3, 3, 4, 1. Getting the maximum down to 3 would take three splits.
sacks=[2, 6, 1], splits=10 → 1
sacks=[10], splits=3
3
Run checks the first 3 tests in your browser. Submit checks all 94 tests on the server, hidden ones included.