Question: Your task is to determine whether it is possible to arrange an even number of players into two teams, of the same size, in order
Your task is to determine whether it is possible to arrange an even number of players into two teams, of the same size, in order to create a balanced tug-of-war game. Player i has a strength, given as strength[i]. In addition, each player has a multiplier depending on where they are placed on a team (because, e.g. certain positions have worse footing). Suppose that you use set an ordering of players in the array position, such that position[i] gives the player who is put in slot i of the game. This ordering will create a balanced game if:

Complete the following Java code to solve this problem (note that the code should use 0-based array indices not 1-based indices as in the description).
static boolean isBalancedGamePossible(int[] strength, int[] multiplier) {
} For example, the call:
isBalancedGamePossible(new int[] {1,2,3,4}, new int[] {2,1,1,3}) returns true
We can arrange player strengths as follows 4,2,1,3. Note that: 4 * 2 + 2 * 1 == 1 * 1 + 3 * 3
isBalancedGamePossible(new int[] {1,2,3,5}, new int[] {1,1,1,1}) returns false, because there is no way to split the players evenly.
strength position ijmultiplier i strength position ij*multiplier ij 2-4-1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
