Problem ยท Array
Lamps Illumination
Learn this problemProblem statement
Each row [left, right] in lamps is an inclusive illuminated interval on a number line.
For every value in points, count how many lamp intervals contain that point. Return the counts in the same order as points.
Function
solution(lamps: int[][], points: int[]) โ int[]Examples
Example 1
lamps = [[1, 7], [5, 11], [7, 9]]points = [7, 1, 5, 10, 9, 15]return = [3, 1, 2, 1, 2, 0]Point 7 belongs to all three inclusive intervals. The remaining points are covered by 1, 2, 1, 2, 0 lamps respectively.