Skip to content

LC 1029 [M] Two City Scheduling

Code with Senpai edited this page May 31, 2022 · 2 revisions
class Solution:
    def twoCitySchedCost(self, costs):
        FirstCity = [i for i,_ in costs]
        Diff = [j - i for i,j in costs]
        return sum(FirstCity) + sum(sorted(Diff)[:len(costs)//2])
Clone this wiki locally