Trains the technique from
LeetCode 3169Count Days Without MeetingsThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A workshop takes bookings over days days numbered 1 through days. bookings[i] = [first, last] reserves the workshop for every day from first to last, both ends included. Bookings may overlap, sit inside one another or arrive in any order.
Return how many of the days days carry no booking at all.
Example 1
Days 1 to 3, 5 to 7 and 9 to 10 are reserved. Day 4, day 8, day 11 and day 12 are left.
Example 2
The second and third bookings sit wholly inside the first, so only days 5 to 10 are reserved and the other fourteen days stay free.
Example 3
The workshop's single day is booked.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def count_days(days: int, bookings: list[list[int]]) -> int:public int countDays(int days, int[][] bookings)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.