lamps[i] = [p, r] stands at point p and lights every integer point of the segment [p - r, p + r], ends included.
The brightness of a point is the number of lamps that light it. Find the integer point with the highest brightness and return its coordinate. If several points tie, return the leftmost (smallest) one.lamps=[[0, 3], [6, 2], [5, 1]] → 4
The lamps cover [-3, 3], [4, 8] and [4, 6]. Points 4, 5 and 6 are lit twice, every other point at most once. The leftmost of the best points is 4.
lamps=[[2, 0], [-1, 3]] → 2
The first lamp lights only point 2, the second lights [-4, 2]. Only point 2 is lit twice.
lamps=[[10, 5]] → 5
The single lamp lights all of [5, 15] equally, so the answer is its left end.
lamps=[[0, 3], [6, 2], [5, 1]]
4
Run checks the first 3 tests in your browser. Submit checks all 114 tests on the server, hidden ones included.