#K15761. Team Skill Balancing
Team Skill Balancing
Team Skill Balancing
You are given N players, each with a specific skill level. Your task is to divide these players into two teams such that the absolute difference between the sum of skills of the two teams is minimized. Formally, if the two team sums are \(S_1\) and \(S_2\) respectively, you need to minimize \(|S_1 - S_2|\), where \(S_1 + S_2 = S\) and \(S\) is the total sum of skills. Note that if N is odd, one team will have one extra player.
inputFormat
The input begins with an integer T denoting the number of test cases. For each test case:
- The first line contains a single integer N, the number of players.
- The second line contains N space-separated integers representing the skill levels of the players.
outputFormat
For each test case, output a single line containing the minimum possible absolute difference between the total skill levels of the two teams.
## sample1
4
1 4 2 3
0
</p>