There are T1 and T2 Teams playing a game.Both Team have N players.The power of T1 team player are represented in an array and Similarly T2 team player.
The rule of Game are follows:
1.There are only N fights.
2.No player of any team can play twice
3.For each fight score generated from (P1 + P2)%N P1 represent power of T1 .Similarly P2
T2 is aware of the order of T1 is sending their player to play the game T2 wants to obtains minimum score in each fight.
Your task is to determine the order in Which T2 is sending player such that they obtain minimum score for each fight
You are required to print score for each round and the other players of T2.
N=3
T1=[1,2,3]
T2=[2,0,1]
Output:[0,0,0]
N=4
T1=[0,1,2,1]
T2=[3,2,1,1]
output:[1,0,0,2]
Explanation Case 1 N=3: [(1+2)%3,(2+1)%3,(3+0)%3]
What is optimal solution for this problem?
One approach is checking one by one power with T1.