← All problemsSign in

Rotten Apples

Mili bought apples for her Kitchen and stored them all in a line. Every apple marked $"X"$ is a rotten one while the apples marked $"O"$ are good apples. Now Mili wants to remove all the rotten apples from her kitchen. - If Mili takes an apple out from the beginning or end of the line it costs her 1units of energy. - While if she takes out an apple from the middle of the line it costs her 2un

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