← All problemsSign in

Ping Pong Balls

Ram has a collection of N ping pong balls, each with a certain weight. He also has a tray that can hold balls with weights ranging from L to R (inclusive). The tray must contain exactly one ball for each weight in this range. Ram will use the balls from his collection that fit within this range. For any missing weights, he needs to buy new balls. The cost of a ball is equal to its weight. Your

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