18 September 2026
Top Food Drive Supply
Hard
Dictionaries
Records
Find the supply type with the largest total number of items delivered to a food drive.
A community food drive receives deliveries throughout the day. Each delivery record contains a supply name and the number of items in that delivery. Add the delivered items for each supply name. Return the supply name with the largest total number of items delivered. If two supply names have the same largest total, return the one that comes first alphabetically.
Constraints
deliveries contains from 1 to 1,000 delivery recordsEach supply name contains from 1 to 30 lowercase ASCII lettersunits is an integer from 1 to 10,000
Function signature
def top_supply(deliveries):