Welcome back.
Let's now try to write the pseudocode for the approach that we have discussed in the previous video.
So as we have discussed, the first step is to sort the costs array on the basis of the difference between
the elements in each element, which in itself is an array.
So we would sort the cost array in ascending order on the basis of costs at the element at index I,
at index zero minus cost at I at index one.
Okay.
So once we are done with this, out of the two n people that we have, we would send the first n people
to city A and the remaining n people to city B, so that's it.
So this is the way that we're going to solve this.
And again, because the question asks us to return the cost involved, we just need to compute the cost
for this and add the cost for this as well to this and finally return the overall cost.
So this is the approach that we will take to solve this question.