Company: Zomato_27thjuly
Difficulty: medium
Team Efficiency Assignment A firm has 2n employees, where the i -th employee ( i = 1, 2, ..., 2n ) has an efficiency equal to i . The firm wants to organize these employees into n teams of 2 members each, with every employee assigned to exactly one team. There are two types of tasks a team can be given: Task Type 1 : the team's efficiency is the minimum efficiency of its two members. Task Type 2 : the team's efficiency is the maximum efficiency of its two members. The firm selects x ( 0 <= x <= n ) of the n teams to perform Task Type 1, and assigns the remaining n - x teams to Task Type 2. The goal is to make the efficiency of the i -th team ( 0 -based index) equal to totalEfficiency[i] , for every i . For a fixed x , the firm is free to choose any pairing of the 2n employees into n teams, and any assignment of which x teams get Task Type 1, as long as the multiset of resulting team efficiencies is exactly the values given in totalEfficiency (order does not matter, sinc