← All problemsSign in

Perfect Necklace

Chef wants to create the perfect necklace for his friend Alice. He has a necklace made up of 3 different types of beads $‘L’$, $’M’$ and $’R’$. Every necklace has exactly one bead of type $’L’$ and exactly one bead of type $’R’$. All other beads are of type $’M’$. Chef considers a necklace perfect if the first bead of this necklace is $’L’$ and the last bead of the necklace is $’R’$ ex-$“LMM

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