Rearrange apples into boxes by moving apples between boxes until every box meets the target condition.
You are given an array representing the number of apples in each box. Your task is to redistribute apples among the boxes so that the final arrangement satisfies the problem's target condition with the minimum necessary redistribution effort.
A valid solution should determine whether the redistribution can be achieved and, if the problem asks for it, compute the minimum number of apples that must be moved. Think carefully about what values must stay fixed and what values can change while preserving the overall total.
Example 1
Input
apples = [1, 3, 2, 4]
Output
true
Explanation
This is an illustrative example. If the target condition is satisfied after redistributing apples while preserving the total number of apples, the configuration is feasible.
Premium problem context
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.