Hackerearth - codemonk -cyclic shift

Can anybody help in one of the hackerearth codemonk question “Cyclic Shift”.
link : https://www.hackerearth.com/practice/codemonk/
please check the 3rd question. I got time limit error in two test cases. i need some help to solve it in O(nlogn) or O(n) time if it is possible.

1 Like

Hey i have optimized it, but getting WA verdict on 3 testcases, AC on others.
Can u share ur approach ?