Skip to content
← Back to the archive

4 September 2026

Helper Activity Counts

Hard Dictionaries Sets

Count the different activities each club helper contributed to.

You are given club help records. Each record contains a helper's name and an activity name. For each helper, count how many different activities they helped with. If the same helper appears for the same activity more than once, count that activity only once. Return a dictionary mapping each helper's name to their number of different activities. Return an empty dictionary when there are no records.

Constraints

  • records contains at most 200 pairs of lowercase strings
  • Each record is written as (helper_name, activity_name)
  • A helper may appear in more than one record

Function signature

def helper_activity_counts(records):

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