Rotate the array?

how to rotate array in counter clock wise by using inbuild rotate function,can we do it by passing compartor??
if yes ,so plz tell ??

@firozbhaikardar21 I don’t think so but there is a way out of this. Suppose there are n elements, and you want to shift your array towards right by x elements (by default rotate() shifts towards left) then you can use
rotate (arr,arr+n-x,arr+n), it should work fine.

1 Like

but i want in opposite direction?

Then simply use rotate(). rotate() by default does it in left direction.
I mentioned the above method if you wanted to do it in direction opposite of what rotate() is supposed to do.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.