leetle

Daily challenge for 2026-10-03

641. Flight Booking Gap Check

You are given a list of scheduled flights where each flight is represented as an interval [start, end] with start < end. Flights can be given in any order.

A passenger needs at least minGap units (a non-negative integer) of free time between consecutive flights to make a connection. Determine if there is at least one pair of chronologically adjacent flights that has a gap strictly less than minGap (an overlap has a negative gap; flights that touch have a gap of 0 and are allowed when minGap is 0).

Return True if such a tight gap or overlap exists, and False otherwise. If there are fewer than 2 flights, return False.

Example:
Input: flights = [[10, 12], [1, 4], [5, 8]], minGap = 2
Output: True
Explanation: Chronologically, the flights are [1, 4], [5, 8], [10, 12]. The gap between flight 1 and flight 2 is 5 - 4 = 1, which is strictly less than minGap (2).

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