Skip to content
← Back to the archive

19 September 2026 · Advanced track

Steadiest Monitor

Advanced Dictionaries Records

Find the monitor with the most reported units, preferring the one with the steadiest report spacing.

A community network logs air-quality reports in the order they arrive. Each report names a monitor and its number of measured units. Add the reported units for each monitor. Return the monitor with the largest total number of units. If monitors tie for the largest total: - Return the monitor whose largest gap between consecutive reports is smallest. - Treat a monitor with one report as having a largest gap of 0. - If those gaps are also tied, return the monitor name that comes first alphabetically.

Constraints

  • reports contains from 1 to 1,000 records
  • Each monitor name contains from 1 to 30 lowercase ASCII letters
  • units is an integer from 1 to 10,000
  • A report gap is the difference between the positions of consecutive reports from the same monitor

Function signature

def steadiest_monitor(reports):

Sign in to solve this bracket

Reading the problem is free for everyone. Opening the editor and solving it requires an account with Open Bracket+.