Trains the technique from
LeetCode 2237Count Positions on Street With Required BrightnessThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
A lane has n posts numbered 0 through n - 1. Each entry lights[j] = [at, reach] is a lamp standing at post at that lights every post from at - reach to at + reach inclusive, clipped to the lane. Several lamps may stand at the same post.
The brightness of a post is how many lamps light it. requirement[i] is the brightness post i must have.
Return how many posts have brightness at least their requirement.
Example 1
The posts end up with brightness 1, 2, 2, 2 and 2. Posts 0, 1, 2 and 4 each reach their requirement, while post 3 needs 4 and has 2.
Example 2
The single lamp reaches far beyond both ends of the lane, so every post is lit once and all four requirements of 1 are met.
Example 3
Every post needs no light at all, so all three qualify whatever the lamp reaches.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def posts_meeting_quota(n: int, lights: list[list[int]], requirement: list[int]) -> int:public int postsMeetingQuota(int n, int[][] lights, int[] requirement)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.