i, a ticket to the first office costs fares[i][0] and a ticket to the second costs fares[i][1].
Return the smallest total ticket cost that puts exactly half of the employees in each office.fares=[[40, 15], [25, 30], [60, 70], [12, 50]] → 117
Employees 2 and 3 fly to the first office (60 + 12), employees 0 and 1 to the second (15 + 30), for a total of 117: employee 1 pays only 5 extra for the second office, less than anyone else would.
fares=[[5, 9], [3, 8]] → 12
Both would rather fly to the first office, but only one can go there. Sending employee 0 to the second office is cheaper: 9 + 3 = 12 versus 5 + 8 = 13.
fares=[[40, 15], [25, 30], [60, 70], [12, 50]]
117
Run checks the first 3 tests in your browser. Submit checks all 58 tests on the server, hidden ones included.