Company: Toast_24nov
Difficulty: medium
Problem Description Toast has 2n employees, where the ith employee has an efficiency equal to i (for i = 1, 2, ..., 2n). Toast wants to organize these employees into n teams of 2 members each, with each employee assigned to exactly one team. A team is assigned to perform either Task Type 1 or Task Type 2: - 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. Toast selects x (0 <= x <= n) teams to perform Task Type 1 and assigns the remaining n - x teams to Task Type 2. Toast's goal is to make the efficiency of each jth team (0-based index) equal to totalEfficiency[j]. Given the number of teams 'n' and the list of target efficiencies totalEfficiency, determine the number of possible values for x (where 0 <= x <= n) for which the target efficiency list can be achieved. For each value of x, Toast can freely choose how to pair employees to form teams. Examples Example