Facebook
From Yedige, 3 Years ago, written in Python.
Embed
Download Paste or View Raw
Hits: 120
  1. class Solution:
  2.     def twoCitySchedCost(self, costs: List[List[int]]) -> int:
  3.         costs.sort(key=lambda x: x[0]-x[1])
  4.         return sum([i[0] for i in costs[:len(costs)//2]]+[i[1] for i in costs[len(costs)//2:]])