3 ms·
Couldn't this be done in 2 rotates rather than 3 : A B C D E A C B D E -- after rotate B, C A D C B E -- after rotate C-B, D Complexity would seem to be the
by HarHarVeryFunny 10mo ago
Couldn't this be done in 2 rotates rather than 3 :
A B C D E
A C B D E -- after rotate B, C
A D C B E -- after rotate C-B, D
Complexity would seem to be the same as the reverse method, since every element in the original B-D range is getting moved twice.