Problems > Closest Two Values > Editorial

Closest Two Values — Solution & Editorial

Back to the Problem

After sorting, the closest pair is adjacent — scan consecutive differences.

Complexity: O(N log N)