loads (positive numbers). One operation picks any server and cuts its load exactly in half; the result may be fractional, and the same server can be picked again later.
Return the fewest operations after which the total load has dropped by at least half of its starting value.loads=[6, 2, 2] → 3
The total is 10, so at least 5 must go. 6 → 3 (3 removed), 3 → 1.5 (1.5 more), 2 → 1 (1 more): 5.5 in total.
loads=[12] → 1
A single halving removes exactly half.
loads=[4, 4] → 2
Halve each 4: 2 + 2 = 4 is removed, exactly half of 8.
loads=[6, 2, 2]
3
Run checks the first 3 tests in your browser. Submit checks all 77 tests on the server, hidden ones included.