Sponsored
Use these hints if you're stuck. Try solving on your own first.
Would sorting help find the optimal order?
Given a specific element, how would you minimize its specific pairwise sum?
Solve with full IDE support and test cases