All Tracks Problem

Rotate an array by k positions in place. No extra array should be used.
/

Very-Easy

Problem
Editorial
Analytics

rotate array anti clock wise by given position.

**Your Algo check manually by mentors . please make sure your algo full fill question conditions .

INPUT: First line No of Test Case T. then T test Case. First given no of Element of array. Then Element Of array. then Value Of D(Rotation Point) .

Output: Rotated Array.

SAMPLE INPUT
2
7
1 2 3 4 5 6 7
2
5
3 5 1 7 8
3
SAMPLE OUTPUT
3 4 5 6 7 1 2
7 8 3 5 1
Explanation

Let us take the same example arr[] = [1, 2, 3, 4, 5, 6, 7], d = 2 Rotate arr[] by one 2 times We get [2, 3, 4, 5, 6, 7, 1] after first rotation and [ 3, 4, 5, 6, 7, 1, 2] after second rotation.

Time Limit: 5.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB

Best Submission

Similar Problems

Contributors

Initializing Code Editor...
Notifications
View All Notifications

?