Tap here to switch tabs
Problem
Submissions

Problem: Brightest Position on Street

Try to solve the Brightest Position on Street problem.

Statement

A street is represented by a number line. You are given a 22D integer array lights where lights[i] = [position_i, range_i] indicates that there is a street lamp at coordinate position_i that illuminates the inclusive interval [‘positioni‘−‘rangei‘,‘positioni‘+‘rangei‘][`position_i` - `range_i`, `position_i` + `range_i`].

The brightness of a position is defined as the total number of lamps illuminating that position.

Return the brightest position on the street. If multiple positions share the maximum brightness, return the smallest position among them.

Constraints:

  • 1≤1 \leq lights.length ≤105\leq 10^5

  • lights[i].length =2= 2

  • −108≤-10^8 \leq position_i ≤108\leq 10^8

  • 0≤0 \leq range_i ≤108\leq 10^8

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Brightest Position on Street

Try to solve the Brightest Position on Street problem.

Statement

A street is represented by a number line. You are given a 22D integer array lights where lights[i] = [position_i, range_i] indicates that there is a street lamp at coordinate position_i that illuminates the inclusive interval [‘positioni‘−‘rangei‘,‘positioni‘+‘rangei‘][`position_i` - `range_i`, `position_i` + `range_i`].

The brightness of a position is defined as the total number of lamps illuminating that position.

Return the brightest position on the street. If multiple positions share the maximum brightness, return the smallest position among them.

Constraints:

  • 1≤1 \leq lights.length ≤105\leq 10^5

  • lights[i].length =2= 2

  • −108≤-10^8 \leq position_i ≤108\leq 10^8

  • 0≤0 \leq range_i ≤108\leq 10^8