Greedy Algorithms - Two City Scheduling
Identify the subtle 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 in range(n):
total += costs[i][0]
for i in range(n, 2*n):
total += costs[i][1]
return total
