Hard · System Design

Amount of New Area Painted Each Day

Given paint, where paint[i] = [start_i, end_i) is the half-open stretch painted on day i, return an array whose i-th value is how much of day i's stretch had not been painted on any earlier day.

Examples

Example 1

[[1,4],[2,5]]

Output: [3, 1]

Example 2

[[1,4],[4,7]]

Output: [3, 3]

Rebuild it in the studio

Open every published interview problem, solution, scene, and memory room free, with no account.

More System Design problems