20 September 2026
Quietest Trailhead
Hard
Dictionaries
Records
Find the trailhead with the smallest total number of recorded hikers.
A national park records how many hikers enter at each trailhead during the day. Each visit record contains a trailhead name and a number of hikers. Add the hiker counts for each trailhead. Return the trailhead with the smallest total number of hikers. If two trailheads have the same smallest total, return the name that comes first alphabetically.
Constraints
visits contains from 1 to 1,000 visit recordsEach trailhead name contains from 1 to 30 lowercase ASCII lettershikers is an integer from 0 to 10,000
Function signature
def quietest_trailhead(visits):