← All problemsSign in

Largest chocolate bar

Lelouch goes to the supermarket and decides to buy the largest chocolate bar available for his younger sister Nunnally. The chocolate bars are all lined up on a table and represented by a binary string where $1$ represents a piece of chocolate bar and $0$ represents empty space. All the consecutive $1$s comprise of a single chocolate bar. Which chocolate bar does Lelouch decide to purchase, if the

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