← All problemsSign in

Happiest Class

There are n children in a class. Each child has a favorite color. The favorite color of the i-th child is fi. As a gift for their promotion to the next class, you plan to give each child k candies as a gift. So, you bring n*k candies to the class and plan to distribute them. Each candy has a single, non-distinct color, i.e., there may be more than one candy with the same color. When a child recei

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start