Obtain Maximum Score Using Minimum Swaps

Asked at Infosys · Coding Questions · Difficulty: Hard · Last asked Jul 15, 2026

Given an array of `N` (even) distinct numbers, rearrange the elements to obtain the maximum score. The score is defined as the product of sums of pairs: `(A1 + A2) * (A3 + A4) * ... * (A[N-1] + A[N])`. You can use swap operations to rearrange the elements. In one swap, you can swap any two numbers. The goal is to obtain the maximum score using the minimum number of swaps.

Loading the problem…