Practice/Google/Leetcode 3169. Count Days Without Meetings
CodingMust
You are given an integer representing the total number of days in a planning period, numbered from 1 to days inclusive. You are also given a list of meeting intervals, where each interval is represented as [start, end] indicating that a meeting occupies all days from start to end inclusive.
Your task is to determine how many days in the range [1, days] have no meetings scheduled. Note that meetings may overlap or touch each other, and you need to account for this when calculating free days.
days (up to 10^9)Example 1:
Input: days = 10, meetings = [[5,7],[1,3],[9,10]] Output: 2 Explanation: The meetings cover days 1-3, 5-7, and 9-10. Days 4 and 8 are free.
Example 2:
Input: days = 20, meetings = [[1,10],[5,15],[8,18]] Output: 2 Explanation: These overlapping meetings merge into a single continuous block covering days 1-18. Only days 19 and 20 are free.
Example 3:
Input: days = 5, meetings = [] Output: 5 Explanation: With no meetings scheduled, all 5 days are free.