I think it's O(n log n + (n-1))

Because one have to sort first, and then compare max n-1 pairs.

Privacy & Terms