Most Visited Sprint Marker
Updated
Problem statement
A track has markers 1 through n. For every adjacent pair in sprints, a runner visits every marker in the inclusive interval between those two endpoints, whether moving forward or backward.
Return the smallest marker with the greatest total visit count across all sprints.
Function
mostVisitedMarker(n: int, sprints: int[]) → intExamples
Example 1
n = 5sprints = [2,4,1,3]return = 2Difference-array range updates reproduce all inclusive sprint visits and preserve the smallest tied marker.
Example 2
n = 3sprints = [1,3]return = 1Difference-array range updates reproduce all inclusive sprint visits and preserve the smallest tied marker.
Example 3
n = 4sprints = [4,1,4]return = 1Difference-array range updates reproduce all inclusive sprint visits and preserve the smallest tied marker.
Constraints
1 <= n <= 200000.2 <= sprints.length <= 200000.1 <= sprints[i] <= n.
Source note: Author-written prompt excerpt retained for source fidelity.
More Chubb Online Assessment questions
- Count Pairs with K Divisible Values in the IntervalOA · Seen Oct 2026
- Index of the Maximum After Left RotationsOA · Seen Oct 2026
- Maximize Revenue from Decreasing InventoryOA · Seen Oct 2026
- Minimize the Maximum Array ElementOA · Seen Oct 2026
- Minimum Distinct Prefix CostOA · Seen Oct 2026
- Flat JSON Value DifferencesOA · Seen Sep 2026
- Maximum Student-Teacher DistanceOA · Seen Sep 2026
- Minimum Cost to Reach a Target WeightOA · Seen Sep 2026
- Minimum Last-Element RelocationsOA · Seen Sep 2026
- How Many Sentences?OA · Seen Sep 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
- Smallest Most-Lit Street PositionHudson River Trading · OAHudson River Trading 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