Elegant Strings
CodeChefOpen on judge ↗
A string of lowercase alphabets is considered to be $k$-elegant if it satisfies all of the following conditions: - The characters on the odd indices are the same (say $c_o$). - The characters on the even indices are the same (say $c_e$). - $c_o$ and $c_e$ are not the same. - The difference between the character on odd and even indices is at most $k$. The difference between $2$ characters is define
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