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

Read every interview problem free. Ten rooms need no account. A token opens a problem in full — Pro never counts.

More System Design problems