Frequency Queries

  • + 0 comments

    Just a quick comment, in

    elif command == 2: f[d[key]] = max(0, f[d[key]] - 1) d[key]= max(0, d[key] - 1) if d[key] > 0: f[d[key]] += 1

    You don't need to check for if d[key] > 0 , as it's already taken care of in the max(0, d[key] - 1) part