I thought about slight variations this question could potentially have in an interview.

Q.1) What if we wanted to minimize the sum of min(ai, bi) or all i from 1 to n?

We should pair the smallest and the largest number together, right?

Q.2) What if we wanted to maximize the sum of min(a(i), a(i+1)) for all i from 1 to (n-1).

Any input on that?