← All problemsSign in

Median Updates

CodeChefRating 1775Open on judge ↗

For a binary string $S$ of length $N$, we define $f(S)$ as another string of length $N$, where the $i$-th character $f(S)_i$ is the median of the characters $S_{i - 1}$, $S_i$ and $S_{i + 1}$. We allow the string to be circular, i.e. we consider $S_0$ as $S_N$ and $S_{N + 1}$ as $S_1$. Given a binary string $S$ of length $N$, define a sequence of strings as follows: - $A_0 = S$ - $A_i = f(A_{i

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