Smallest Most-Lit Street Position
Updated
Problem statement
A streetlight centered at positions[i] with radius radii[i] illuminates every integer position from positions[i] - radii[i] through positions[i] + radii[i], inclusive.
Return the smallest integer position illuminated by the maximum number of streetlights.
Function
mostLitPosition(positions: int[], radii: int[]) → intExamples
Example 1
positions = [0,5]radii = [2,3]return = 2The two inclusive intervals overlap only at position 2.
Example 2
positions = [1,4,7]radii = [3,0,3]return = 4All three streetlights illuminate position 4.
Example 3
positions = [0,10]radii = [1,1]return = -1The maximum coverage is one in two disjoint intervals, so the smallest covered position is -1.
Constraints
1 <= positions.length = radii.length <= 200000.-10^8 <= positions[i] <= 10^8.0 <= radii[i] <= 10^8.
More Hudson River Trading Online Assessment questions
- Count Palindrome Addition ChoicesOA · Seen Nov 2026
- Count Multiples of Three with Two SevensOA · Seen Oct 2026
- Recursively Expanded Shell Command CountsOA · Seen Oct 2026
- Rotate Matrix Regions Around the DiagonalsOA · Seen Oct 2026
- Maximum Diamond SumOA · Seen Oct 2026
- Rearrange String by Alternating EndsOA · Seen Sep 2026
- Most Items Within Budget from a Start IndexOA · Seen Sep 2026
- Count Fancy NumbersOA · Seen Sep 2026
- Count Sawtooth SubarraysOA · Seen Aug 2026
- Backtick Identifier ConverterOA · Seen Jun 2026
Similar questions at other companies
- Earliest Time to Schedule a MeetingMathWorks · OAMathWorks interview questions
- Earliest Meeting Start on a 24-Hour ClockIMC Trading · OAIMC Trading interview questions
- Earliest Time to Schedule a MeetingMicrosoft · OAMicrosoft interview questions
- Earliest Common Meeting StartVisa · OAVisa interview questions
- Most Visited Sprint MarkerChubb · OAChubb interview questions
- Earliest Common Meeting TimeZipRecruiter · OAZipRecruiter interview questions
- File Download Coverage PercentagePersona · OAPersona interview questions
- Peak Chat Load Across AgentsCresta · PHONE SCREENCresta interview questions
- Majority Labels over Audio IntervalsNooks · PHONE SCREEN
- Zero Array Transformation IGoogle · ONSITE INTERVIEWGoogle interview questions