Leetcode 1095 Solution
This article provides solution to leetcode question 1095 (two-city-scheduling)
Access this page by simply typing in "lcs 1095" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
class Solution: def twoCitySchedCost(self, costs: List[List[int]]) -> int: n = len(costs) // 2 costs = sorted([(cost1 - cost2, cost1, cost2) for cost1, cost2 in costs]) return sum([cost1 for _, cost1, _ in costs[0:n]] + [cost2 for _, _, cost2 in costs[n:]])