FastPrepCount Lamps Lighting Each Point
Problems/Count Lamps Lighting Each Point

Count Lamps Lighting Each Point

Airbnb logoAirbnb● MediumINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Airbnb online assessment with four coding questions. One of them asked how many lamps light up a given position, where each lamp covers a range of positions on a line and both ends count. The report gives only a short summary and solution ideas, not the full question.

It does not give the input shape, how equal lamps count, or any limit except that positions go up to 10^5. Here, you get the lamps as start and end pairs plus a list of positions, and you return one count per position in the same order. Equal lamps each count, positions start at 0, and there are up to 10^5 lamps and positions.

Our version is about 70% the same as the reported question.

Special thanks: 🌷 A special thank you to a lovely, amazing fren who shared that this question also appeared on November 19, 2026! (˶˃ ᵕ ˂˶) .ᐟ.ᐟ 🩷

Given a 2D integer array lamps and an integer array points, return an integer array answer where answer[j] is the number of lamps that light the position points[j].

All lamps and points are on one number line. Lamp i lights every position x with lamps[i][0] <= x <= lamps[i][1], so both ends of its range are lit.

Each row of lamps is its own lamp. If two rows are equal, both lamps count.

Function

lampsPerPoint(lamps: int[][], points: int[]) → int[]

Examples

Example 1

lamps = [[2,6],[4,9],[9,12]]points = [5,9,1,12]return = [2,2,0,1]
  • 5 is inside [2, 6] and [4, 9], so 2.
  • 9 is the right end of [4, 9] and the left end of [9, 12], so 2.
  • 1 is left of every lamp, so 0.
  • 12 is the right end of [9, 12] only, so 1.

Example 2

lamps = [[3,3],[1,5],[1,5]]points = [3,5,3,0]return = [3,2,3,0]

Position 3 is lit by the one-point lamp [3, 3] and by both copies of [1, 5], so it gets 3 each time it appears. Position 5 is lit only by the two copies of [1, 5], and 0 is lit by none.

Example 3

lamps = [[0,100000]]points = [0,100000,50000]return = [1,1,1]

The one lamp runs from 0 to 100000, so it lights every allowed position, and each of the three points gets 1.

Constraints

  • 1 <= lamps.length <= 10^5
  • lamps[i].length == 2
  • 0 <= lamps[i][0] <= lamps[i][1] <= 10^5
  • 1 <= points.length <= 10^5
  • 0 <= points[j] <= 10^5

More Airbnb Online Assessment questions

  • Count Card Duel RoundsOA · Seen Nov 2026
  • Simulate Orchard Rot SpreadOA · Seen Nov 2026
  • Sort Adjacent PairsOA · Seen Nov 2026
  • In-Memory File SystemOA · Seen Nov 2026
  • Task Management SystemOA · Seen Nov 2026
  • Recipe Management SystemOA · Seen Nov 2026
  • Progressive Banking SystemOA · Seen Nov 2026
  • Credit Accounts with Scheduled TransfersOA · Seen Oct 2026
  • Parcel Attribute Store with TTLOA · Seen Oct 2026
  • Parcel Event TrackingOA · Seen Oct 2026

Similar questions at other companies

  • Choose ContainersIMC Trading · OAIMC Trading interview questions
  • Calculating QuantilesIndeed · OAIndeed interview questions
  • Count Lamps Lighting Each PointCapital One · OACapital One interview questions
  • Minimum Cost to Make Array EqualWalmart · OAWalmart interview questions
  • Subscription and Usage-Based Billing CalculatorStripe · OAStripe interview questions
  • Maximum Interactive Team SizeMicrosoft · OAMicrosoft interview questions
  • Linear InterpolatorTwo Sigma · OATwo Sigma interview questions
  • Minimum Seats for One-Way Car PoolingSquadStack.ai · OA
  • Find Sum of BeautiesAmazon · OA
  • Minimize Maximum Group DifferenceDRW · OADRW interview questions

Airbnb interview experiences

  • Airbnb OA · November 2026
  • Airbnb Campus and Full-Time SWE OA / Interviews: 9 Experiences
  • Airbnb Intern Phone Interviews: 21 Experiences (Part 7 of 7)
  • Airbnb Intern OA and Phone Screens: 17 Experiences (Part 6 of 7)
  • Airbnb Intern OA and Onsite Rounds: 16 Experiences (Part 5 of 7)
  • Airbnb Intern OA, Diplomacy Game: 19 Experiences (Part 4 of 7)
All Airbnb interview questionsSee Airbnb hiring insights
Saved
class Solution {
    public int[] lampsPerPoint(int[][] lamps, int[] points) {
      // write your code here
    }
}
Checking account…