An array * X* consists of

*integers. The indices of any two elements of the array can be swapped with each other.*

**N**Write a program to find the minimum contiguous sum of the elements of the array that is obtained by performing a maximum of * K* swaps in the array.

(The resulting contiguous sub-array that is selected for the optimal answer should not be empty).

**Input format**

- First line: T (Number of test cases)
- First line in each test case:
and**N****K** - Second line in each test case:
space-separated integers (denoting the elements of the array**N**)**X**

**Output format**

For each test case, print the minimum contiguous sum of the elements that is obtained by performing at most * K* swaps.

question link: here

p.s. : the question is from a challenge that is over now : )

my approach is to select k smallest elements from the array, but it’s not working…

can anyone share the approach for this question?