Two City Scheduling

Medium · Greedy · about 15 minutes

Asked at Bloomberg, Amazon, Google, Meta.

2n people will be interviewed; costs[i] = [aCost, bCost] is the cost of flying person i to city A or B. Exactly n people must go to each city. Return the minimum total cost.