Apple Division
There are n apples with known weights. Your task is to divide the apples into two groups so that the difference between the weights of the groups is minimal. Input The first input line has an integer n: the number of apples. The next line has n integers p_1,p_2,\dots,p_n: the weight of each apple. Output Print one integer: the minimum difference between the weights of the groups. Constraints 1 \l
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start