#203EasyPrefix Sums & Difference Arrays· Difference Array for Range Updates
Booking Overlap Heatmap
Input format
`days`: the number of days. `bookings`: a list of `[first, last]` pairs.
Output format
An array of `days` integers, the number of bookings covering each day.
Examples
Input: days = 5, bookings = [[0, 2], [1, 3], [2, 2]]
Output: [1, 2, 3, 1, 0]
Day 0 is covered once, day 1 twice, day 2 three times, day 3 once and day 4 never.
Input: days = 3, bookings = []
Output: [0, 0, 0]
With no bookings every day has a count of 0.
Constraints
- 1 <= days <= 10^5
- 0 <= bookings.length <= 10^5
- 0 <= first <= last < days
- #difference-array
- #prefix-sums
- #arrays
- #range-updates