← All problemsSign in

Penny and Candies

Penny pretends to be very smart. Her friend Sheldon gives her a task to test her smartness level. Sheldon gives her $N$ candies. Each $ith$ candy has a label $Ai$ showing its sweetness level. Penny has to put exactly $K$ candies in a box such that the box has balanced sweetness. The balanced sweetness here means that the sweetest candy in the box should not be sweeter than $P$ times the least swe

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