PALINDR using Treaps

As written in the tutorial of the Lucky and Pallindrome (PALINDR) we can solve the last sub tasks using treaps. But after going through tester’s and setter’s solution I am unable to get how they have used treaps for reversing the string.
Please help…

2 Likes
//