Skip to content
← Back to the archive

12 September 2026 · Advanced track

Most-Visited Exhibit

Advanced Dictionaries Records

Find the exhibit with the highest total visitor count, breaking ties by fewest contributing visit records.

A museum logs visitor counts for its exhibits throughout the day. You are given a list of visit records, each naming the exhibit and how many visitors arrived at that time, in the order the visits happened. Add up the total visitor count for each exhibit. Return the exhibit with the highest total visitor count. If two or more exhibits are tied for the highest total, return whichever of those exhibits reached its total using the fewest separate visit records.

Constraints

  • visits has between 1 and 1000 entries
  • each exhibit name has between 1 and 30 characters
  • visitor_count is a whole number between 0 and 100000

Function signature

def most_visited_exhibit(visits):

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