rotating an array

can anyone help me with an efficient solution to rotate an array?

not getting solution of the above?

Hey @while_1, if you scroll down to the bottom of any problem page you will (usually) find a link to the editorial for the problem where is solution is explained by the problem setters. Here is the link, take a look.

1 Like

Tell us which part of editorial line is not getting to you? I think framing of Editorial is nice according to the beginners level also.

This is a cakewalk. You can check my solution. It is a mere 15 lines C++ code and I have put comments

Hope it helps


Actually I want to do it another way…but it was not so efficient

But you didn’t mention about this that you have already seen the editorial solution. You must had inform us that you want another approach apart from editorial solution