Skip to content
Decoder

Count Days Without Meetings

Medium

Problem

An employee is available on days 1 to days. meetings[i] = [start, end] books every day from start to end, inclusive. Meetings may overlap. Return how many days have no meeting at all.

Example 1

Input
days = 10, meetings = [[5, 7], [1, 3], [9, 10]]
Output
2
Why
days 4 and 8

Example 2

Input
days = 5, meetings = [[2, 4], [1, 3]]
Output
1
Why
day 5

Example 3

Input
days = 6, meetings = [[1, 6]]
Output
0

Constraints

  • 1 <= days <= 10^9
  • 1 <= meetings.length <= 10^5
  • 1 <= start <= end <= days

Read it once before you touch anything

Want some pressure? Start the timer. In an interview you get about two minutes to understand the problem.

  1. 1Read the goalWhat goes in, what comes out
  2. 2Scan the examplesCheck one by hand
  3. 3Note the constraintsThey set your Big O
Say what it asks in one sentence
Say it out loud first, then compare with ours.