leetle

Daily challenge for 2026-04-09

464. Smallest Gaps Between Logs

You are given a list of logs, where each log is represented as an interval [start, end]. The logs are already sorted by their start times. Your task is to find the length of the smallest gap between any two consecutive logs. Overlapping or touching consecutive logs have a gap length of 0. If there is only one log, return 0.

Example:
Input: logs = [[1, 3], [5, 8], [10, 12]]
Output: 2
Explanation: The gap between [1, 3] and [5, 8] is 5 - 3 = 2. The gap between [5, 8] and [10, 12] is 10 - 8 = 2. The minimum is 2.

Run this challenge interactively in Python or JavaScript when the app loads.