← All problemsSign in

Mahak and her candies

Mahak is sitting in front of a table. She found N sealed boxes of candies on the table. She is not sure how many candies each box contains. However, she knows the following information: - The total number of candies in the boxes is C. - For each i, box i (0-based index) contains between 0 and high[i] candies, inclusive. You know that Mahak eats candies as follows: First she chooses a subset of

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