Skip to content
← Back to the archive

20 September 2026 · Advanced track

Zone Coverage Window

Advanced Lists Dictionaries

Find the shortest consecutive check-in run that gives both specified zones enough coverage.

A community event logs check-ins by zone in the order they happen. You are given the full check-in list, two different zone names, and a required number of check-ins for each zone. Find the shortest consecutive run of check-ins that contains at least the required number from both specified zones. Check-ins from other zones may appear inside the run. Return the inclusive index range [start, end] for that run. If multiple shortest runs exist, return the one that starts earliest. If no run has enough check-ins from both zones, return [-1, -1].

Constraints

  • checkins contains from 0 to 20,000 lowercase ASCII zone names
  • first_zone and second_zone are different lowercase ASCII names
  • minimum is an integer from 1 to 10,000
  • Returned indexes are zero-based and inclusive

Function signature

def shortest_coverage_window(checkins, first_zone, second_zone, minimum):

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+.