Matchmaking Gap
Medium · rating 1350 · Sorting, Greedy
A matchmaker pairs an even number of players to minimise skill mismatches. The first line has n (even). The second line has n ratings. Sort them, pair them up in adjacent order, and print the total rating gap across all pairs.
Constraints: 2 ≤ n ≤ 105, n even
Related problems
- Shopping on a Budget — Medium
- Double-Booked? — Medium
- Fit the Most Tasks — Medium
- Minimum Meeting Rooms — Hard
- Job Sequencing — Hard
- Count Anagram Groups — Medium