Problems > Best Pairing > Editorial

Best Pairing — Solution & Editorial

Back to the Problem

Sort and pair adjacent values: big×big and (−big)×(−big) — an exchange argument shows any crossing pairing is never better.

Complexity: O(N log N)