Distinct Substring
A binary string is a string consisting of $0$ and $1$. We define an *island* as a [substring](https://en.wikipedia.org/wiki/Substring) consisting of all $0$s bounded by $1$s (or the ends of the string). For example, in the string $100010000$, there are $2$ islands; $000$ (bounded by $1$s) and $0000$ (bounded by $1$ and end of string). Note that the substring $00$ in the above string is not an is
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