Click here to see the full article post
@zestypanda Thanks for pointing it out. I have removed #3 approach.
@dimessi I've updated the description in the 3rd approach. Hope it'll be clear now.
@Ryanm In that case also, the distance calculation isn't max-min, but it is MAX(max-a, a[n-1]-min). Here a and a[n-1] belong to the next array being considered. Thus, the distance is always calculated among separate arrays only. You can see the illustration above which includes this case as well.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.