1
// costs = [[259,770],[448,54],[926,667],[184,139],[840,118],[577,469]]2
// The difference between them would be like this [511, -394, -259, -45, -722, -108] this will3
// give us the differnce c[1] - c[0]4
// Now after sorting them from highest to smallest would be [511, -45, -108, -259, -394,-722] from5
// high to low c2[1] - c2[0], c1[1] - c1[0] if we want low to high then it would be like this c1[1]6
// - c1[0], c2[1] - c2[0]10
public int twoCitySchedCost(int[][] costs) {12
costs, (c1, c2) -> Integer.compare(c2[1] - c2[0], c1[1] - c1[0])); // biggest to smallest15
for (int i = 0; i < n; i++) {19
: costs[i][1]; // First half -> A; Last half -> B 259 + 184 + 577 + 54 + 667 + 118