Skip to main content

Practice · 1 of 5

Minimum Difference

CHALLENGE
Difficulty: beginner+25 XP

**Description:** Given n integers, find the minimum absolute difference between any two of them. **Input:** Line 1: n (2 <= n <= 10^5). Line 2: n integers (|a_i| <= 10^9). **Output:** One integer — the minimum difference. **Example:** 4 / 10 -7 3 22 -> 7 (pair 3 and 10).

Back to lesson: Practice: Sorting Set