Search
⌘K
Get Premium
Leetcode 1943. Describe the Painting
Given half-open colored segments that overlap and mix (where a mixed color is the set-sum of active colors), produce the minimal list of non-overlapping half-open segments that describe the painting by reporting, for each contiguous range, the sum of distinct colors present. This is solved by a sweep-line over endpoints (or sorting events), tracking the current set/sum of active colors and emitting/merging ranges whenever that sum changes.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.