Minimum shift coverage
Your task
A dispatcher must keep at least one courier on duty for the entire window from time 0 to time t (t >= 1). shifts[i] = [start, end] means courier i is willing to work that whole span. Return the minimum number of shifts to select so that every moment in [0, t] is covered, or -1 if it cannot be done. Example: shifts [[0,2],[1,5],[4,7]] with t = 6 needs 3 shifts.
Examples
min_shifts(shifts: list[list[int]], t: int) -> intExample 1
Input
min_shifts([[0, 2], [1, 5], [4, 7]], 6)Output
3