Daily challenge for 2026-10-05
643. Sorted Departure Gaps
You are given a list of scheduled departure times departures, represented as positive integers in minutes from midnight. The departures may not be in chronological order.
First, sort the departures in ascending order. Then, compute and return the minimum gap (difference) between any two consecutive scheduled departures. If there are fewer than 2 departure times, return -1.
Example:Input: departures = [120, 45, 180, 75]Output: 30
Explanation: Sorting the times gives [45, 75, 120, 180]. The differences between adjacent times are 75 - 45 = 30, 120 - 75 = 45, and 180 - 120 = 60. The minimum gap is 30.
Run this challenge interactively in Python or JavaScript when the app loads.