← All problemsSign in

Good String

Given a string of length N which contains only $A$ or $B$ characters. A good string is the one in which all the characters are same. You need to find the longest substring that is a good string by doing the one of the following operation only once. - Choose a good substring and subtract $1$ from all the characters of this substring. - or add $1$ to all the characters of this substring. Subtract

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