Snehal and CupCakes
CodeChefOpen on judge ↗
Snehal loves cupcakes. On her birthday, she received N cupcakes, each with an associated taste score. However, there is a restriction: - She can eat at most 3 consecutive cupcakes. - After eating 3 consecutive cupcakes, she must skip at least 1 cupcake before continuing. Snehal wants to choose cupcakes in such a way that the total taste score is maximized. Determine the maximum possible sum 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.
Sign in to chat with the tutor and save your progress.
Sign in to start