D - Delete if Equal
CodeChefOpen on judge ↗
You are given a binary string $S$ of size $N$. You can do the following operation as many times you want: - Choose an index $i$ satisfying $1 < i < |S|$ and $S_{i - 1} = S_{i + 1}$, and delete $S_i$ from the string. Then, concatenate the $2$ parts $S[1, i - 1]$ and $S[i + 1, |S|]$ to form the new string $S$. Note that the length of $S$ reduces by $1$ after each operation. Find the minimum p
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