Binary Strings Yet Again
For a ($0$-indexed) binary string $S$ of length $N$, define $f(S) = $ the number of pairs $(i, j) $ such that $0 \leq i \lt j \lt N$ and $S_i = 0, S_j = 1$. Given a binary string $S$ of size $N$, you can perform the following operation **exactly once**: - Choose an integer $K$ such that $1 \lt K \le N$ and $N \bmod K = 0$, and divide the string into continuous substrings of size $K$, i.e. you wil
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