SWAPPALI Video Solution

Official editorial: SWAPPALI - Editorial
Link: https://www.youtube.com/watch?v=MSJyO4IRmHM



Getting WA for this solution.

Please edit your code or give a link to it.

(Credit: @ssjgz)


What’s wrong with this solution?


There’s a special case in the loop when l+1==r

1 Like

I think you are also missing the special case with l+1==r

1 Like

Sir,can you help ,why am i getting TLE in swappali in one of the second subtask
link to my solution : https://www.codechef.com/viewsolution/29996631

Copying strings is O(n) time, and you do that in each iteration.

thank you sir

Hey ,where is the editorial (official) of this problem?

I’m still working on it. I hope people can be understanding with late editorials. Detailed writeups take a lot of time, and by the way, a lot of the problems for this contest (including SWAPPALI) were not fully prepared until several hours before the contest. There was even one problem that was finished 5 minutes before the contest started.

Ok take your time.