Company: Zscaler__
Difficulty: medium
Efficient Teams Problem Description A firm has 2 * n employees. The i-th employee has an efficiency equal to i , for i = 1, 2, ..., 2 * n . The firm organises all of them into n teams of exactly two members each, and every employee belongs to exactly one team. A team performs one of two kinds of task: Task Type 1 : the team's efficiency is the minimum of the efficiencies of its two members. Task Type 2 : the team's efficiency is the maximum of the efficiencies of its two members. The firm picks a number x with 0 <= x <= n , gives Task Type 1 to x of the teams and Task Type 2 to the remaining n - x teams. The firm wants the team efficiencies to be exactly the values listed in totalEfficiency : the i-th team (0-based) must end up with efficiency totalEfficiency[i] . For a fixed x the firm may pair the employees however it likes and may choose which teams take which task type. Count the values of x in 0 <= x <= n for which at least one valid arrangement exists. Function Descri