← All problemsSign in

Prefix Zeros

CodeChefRating 1790Open on judge ↗

You are given a string $S$ of length $N$, which consists of digits from $0$ to $9$. You can apply the following operation to the string: - Choose an integer $L$ with $1\le L \le N$ and apply $S_i = (S_i + 1) \mod 10$ for each $1 \le i \le L$. For example, if $S=39590$, then choosing $L=3$ and applying the operation yields the string $S=\underline{406}90$. The prefix of string $S$ of length $l\;

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