PROBLEM STATEMENT
Given a list of integers which represent the strength of each child on the
playground, form teams for tug-of-war that are as evenly matched as possible in
terms of strength (i.e., the total strength of each team is as close to equal
as possible), and return the total pulling power of the stronger team.
DEFINITION
Class: TugOfWar
Method name: makeTeams
Parameters: int[]
Return type: int
Method signature: int makeTeams(int[] strength); (be sure your method is public)
Topcoder will ensure that:
- strength contains between 2 and 20 elements inclusive.
- each int in strength has a value between 5 and 50 inclusive.
NOTES
* If the two teams come out evenly matched (total team strengths are equal),
return the strength of either team (doesn't matter which, since the result is
the same).
EXAMPLES
strength = [5, 9, 7, 8, 6]
return 18
Team 1: 5 + 6 + 7 = 18
Team 2: 8 + 9 = 17
strength = [5, 10, 15, 20]
return 25
Team 1: 5 + 20 = 25
Team 2: 10 + 15 = 25
strength = [10, 12, 15]
return 22
strength = [5, 50]
return 50