← All problemsSign in

Counting 01 and 10

CodeChefRating 1776Open on judge ↗

Given a binary string $S$, let $X$ denote the number of $01$ subsequences and $Y$ denote the number of $10$ subsequences in it. For example, for $S = 10010$, there are $2$ $01$ subsequences and $4$ $10$ subsequences, so $X = 2$ and $Y = 4$. Let $f(S) = (X, Y)$, i.e. the function value is the pair of values $X$ and $Y$ for the given string. Consider all binary strings of length $N$. How many di

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