Greedy Algorithms - Two City Scheduling
Identify the bug in the following code snippet for Two City Scheduling:
def twoCitySchedCost(costs):
costs.sort(key=lambda x: abs(x[0] - x[1]))
n = len(costs) // 2
total = 0
for i, cost in enumerate(costs):
if i < n:
total += cost[0]
else:
total += cost[1]
return total
