Company: Toast_24nov
Difficulty: medium
Toast's Efficient Teams 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 min(1, 5) = 1 - Team 2 (Type 1): {2, 6} -> min(2, 6) = 2 - Team 3 (Type 2): {3, 4} -> max(3, 4) = 4 This results in the efficiency array [1, 2, 4]. - x = 3: Possible. All 3 teams are type 1. A possible assignment is {(1, 3), (2, 6), (4, 5)}. - Team 1 (Type 1): {1, 3} -> min(1, 3) = 1 - Team 2 (Type 1): {2, 6} -> min(2, 6) = 2 - Team 3 (Type 1): {4, 5} -> min(4, 5) = 4 This also results in the efficiency array [1, 2, 4]. Since x = 2 and x = 3 are possible, the answer is 2. Example