Sonic And Partition
CodeChefOpen on judge ↗
Sonic wants to partition an array S into two disjoint sets A and B such that the sum of absolute difference of all pair of elements in A + sum of absolute difference of all pair of elements in B is minimum. Please help him to the find the minimum value. Note: - It is not necessary that the division should be contiguous. - The set can contain 0 or 1 elements. - The size of the two parts need no
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