Sponsored
Use these hints if you're stuck. Try solving on your own first.
Sort array <code>capacity</code> in non-decreasing order.
Greedily select boxes with the largest capacities to redistribute apples optimally.
Solve with full IDE support and test cases