Reported September 2026
Capital Oneprefix sum

Brightest Position on a Street

Reported by candidates from Capital One's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Capital One OA. Under 2s to a working solution.
Founder's read

The mistake that sinks a first attempt on this Capital One question is looping over every coordinate each light covers. The September 2026 report is Brightest Position on a Street, and with radii up to 10^8 that approach times out before it finishes a single big test. You get an array of [position, radius] lights and must return the smallest coordinate with the highest brightness. The pattern is a difference array built from sorted events, a sweep line. If you blank during the live OA, StealthCoder runs invisibly on your desktop and hands you the sweep as a safety net.

The problem

Each row [position, radius] in lights describes a street light at an integer coordinate. It illuminates every integer coordinate in the inclusive interval [position - radius, position + radius].
The brightness of a coordinate is the number of lights that illuminate it. Return the smallest coordinate having the maximum brightness.

Function
brightestPosition(lights: int[][]) → int

Examples
Example 1
lights = [[-3,2],[1,2],[3,3]]
return = -1
Coordinate -1 is the smallest coordinate illuminated by the maximum of two lights.
Example 2
lights = [[1,0],[0,1]]
return = 1
Coordinate 1 is illuminated by both lights.

Constraints
1 <= lights.length <= 10^5
lights[i].length == 2
-10^8 <= position <= 10^8
0 <= radius <= 10^8

Reported by candidates. Source: FastPrep

Pattern and pitfall

Each light is an interval [p - r, p + r]. Don't paint the interval. Record two events instead: +1 at p - r, and -1 at p + r + 1, since the end is inclusive. Sort the events by coordinate, or collect them in a map and sort the keys. Then sweep left to right, keeping a running sum. Brightness only changes at event coordinates, so the maximum always starts at one. Apply all events sharing a coordinate before you compare. Update the answer only on a strictly greater brightness, which keeps the smallest coordinate on ties. The common pitfall is putting the -1 at p + r, which drops the light one coordinate early. Another is comparing mid-group. Complexity is O(n log n) with 10^5 lights. If your head goes blank during the live OA, StealthCoder is the hedge that shows the event sweep so you can type it out cleanly.

If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.

If this hits your live OA

You can drill Brightest Position on a Street cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as brightest position on street. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Capital One's OA.

Capital One reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Brightest Position on a Street FAQ

What's the trick in Brightest Position on a Street?+

Don't iterate coordinates. Turn each light into a +1 event at p - r and a -1 event at p + r + 1, sort the events, and sweep with a running sum. The best brightness always begins at some event coordinate, so you only check those.

Why is brute force too slow here?+

Radius can reach 10^8 and there can be 10^5 lights. Marking every covered coordinate could mean billions of operations, and the coordinate range spans about 2 x 10^8. The sweep only touches 2n events, so it stays fast.

How do I handle ties for the smallest coordinate?+

Sweep in ascending order and update your best answer only when the current brightness is strictly greater than the best so far. The first coordinate to reach the max stays as the answer. Process all events at the same coordinate before comparing.

What edge cases should I test before submitting?+

Test a radius of 0, like [1,0] in example 2. Test negative coordinates, a single light, and lights whose intervals touch end to start. The inclusive end is the big one, so make sure the -1 lands at p + r + 1.

How do I prepare for this in 48 hours?+

Write the sweep line once from memory: build events, sort, accumulate, track the max. Then do two variants, like meeting rooms or merging intervals, to lock in the event idea. This pattern is a standard interval-counting problem, so one clean pass is enough.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Capital One.

OA at Capital One?
Invisible during screen share
Get it