Slight variation of Array Partition 1


  • 0
    A

    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?


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.