I don't know why is this giving runtime error!

Revision en1, by mahmoud13, 2025-02-20 12:29:48

I was solving this problem 2069D\ - Palindrome Shuffle. It is giving me Runtime error on test 2. My idea to solve this problem is to first know how many chars from the beginning of the string equal chars from the end, so these chars don't have to be swapped with any other char. Then in the rest of the string I should use suffix or prefix of the string to make it palindrome. To calculate the answer to the problem, it is just the max distance between the end of the string and a char I used to do the swap. My code is in the spoiler.

Spoiler
Tags strings, runtime error

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English mahmoud13 2025-02-20 12:29:48 2338 Initial revision (published)