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.
More Databricks problems
- Blocking Keyed Cache with Waiting ReadersONSITE INTERVIEW Β· Seen Jul 2026
- Rectangular K-in-a-RowONSITE INTERVIEW Β· Seen Jul 2026
- Snapshot Set IteratorPHONE SCREEN Β· ONSITE INTERVIEW Β· Seen Jul 2026
- Durable Data WriterONSITE INTERVIEW Β· Seen Jul 2026
- Find First Anagram IndexPHONE SCREEN Β· Seen Apr 2026
- Minimize CommuteOA Β· Seen Apr 2026
- Difference Between Sums of PositionsOA Β· Seen Sep 2024
- Longest Common Prefix of Number PairsOA Β· Seen Sep 2024