Skip to content
← Back to the archive

9 September 2026 · Advanced track

Tallest District Total

Advanced Dictionaries Records

Find the district with the highest total building height, breaking ties by the tallest single building.

A city planner logs buildings across several districts. You are given a list of building records, each naming its district and its height, in the order they were recorded. Add up the total height of all buildings in each district. Return the district with the highest total height. If two or more districts are tied for the highest total, return whichever of those districts contains the single tallest building.

Constraints

  • buildings has between 1 and 1000 entries
  • each district name has between 1 and 30 characters
  • height is a whole number between 1 and 100000

Function signature

def tallest_total_district(buildings):

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