#351 Finding Step Count Champions

Companies:
Avito
Themes:
JavaCollections & GenericsPractice

At Avito, we enjoy holding competitions. Recently, we organized a step-count championship, and now it is time to determine the results! Find the userIds of the participants who walked the greatest total number of steps over all days without missing a single competition day.

# Example 1
# input
statistics = [
    [{ userId: 1, steps: 1000 }, { userId: 2, steps: 1500 }],
    [{ userId: 2, steps: 1000 }]
]

# output
champions = { userIds: [2], steps: 2500 }


# Example 2
# input
statistics = [
    [{ userId: 1, steps: 2000 }, { userId: 2, steps: 1500 }],
    [{ userId: 2, steps: 4000 }, { userId: 1, steps: 3500 }]
]

# output
champions = { userIds: [1, 2], steps: 5500 }

Question review

Mentor
Answer as you would in a real interview. I’ll ask follow-up questions, then compare your answer with the reference answer and show your accuracy as a %.
Sign in to start the dialogue The mentor keeps the context of the current question and your previous messages.
Sign in