# sorting medium

The Closest Rivals

Which two racers finished closest together? Here's the secret: after sorting, the closest pair are ALWAYS neighbors. 🏎️

You get at least two finish times. Print the smallest gap between any two of them.

Example:

Input: times = [10, 55, 32, 29] Output: 3

Sorted, the list becomes [10, 29, 32, 55] — the closest neighbors are 29 and 32, a gap of 3.

💡 need a hint?

sort-closest-rivals.py🔒 given lines are locked — write your code in between
loading...