← All problemsSign in

Palindrome Swaps

CodeChefRating 2757Open on judge ↗

Chef has $N$ strings. Each string $S_i$ has length $M$ and consists only of lowercase english letters. Chef likes [palindromes](https://en.wikipedia.org/wiki/Palindrome), and would like each $S_i$ to be a palindrome. To achieve this, he can perform the following move: - Pick an index $i$ such that $1 \leq i \lt N$ and an index $j$ such that $1 \leq j \leq M$. - Then, swap the $j^{th}$ character o

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