#C2695. Minimum Difference Partition
Minimum Difference Partition
Minimum Difference Partition
You are given a number of test cases. In each test case, you are provided with n participants and an array of their respective skill levels. Your task is to split these participants into two teams such that the absolute difference between the sum of the skills of the two teams is minimized.
In other words, if the two teams have sums S1 and S2, you need to minimize \( |S_1 - S_2| \).
Input Format: The first line contains a single integer T, the number of test cases. For each test case, the first line contains a single integer n, and the second line contains n space-separated integers representing the skill levels.
Output Format: For each test case, output the minimized absolute difference on a new line.
inputFormat
The input begins with an integer T (1 \(\leq T \leq 100\)), representing the number of test cases. Each test case consists of two lines:
- The first line contains an integer n (1 \(\leq n \leq 1000\)), the number of participants.
- The second line contains n space-separated integers, where each integer \(a_i\) (\(1 \leq a_i \leq 10^4\)) denotes the skill level of a participant.
outputFormat
For each test case, print a single line containing the minimum absolute difference between the sums of the two teams.
## sample3
4
1 2 3 4
3
1 1 4
5
6 3 2 8 7
0
2
0
</p>