
Return the resulting rotated array.
Input :
A = [6, 2, 6, 1], X = 1, DIR = ‘LEFT’
Output :
2 6 1 6
Explanation: Rotate array ‘A’ to the left one time.
[6, 2, 6, 1] => [2, 6, 1, 6]
First-line contains 'T,' denoting the number of Test cases.
For each Test case:
The first line contains two integers, ‘N', ‘X’, and the string ‘DIR’.
The second line has ‘N’ integers denoting the array ‘A’.
You must return the rotated array.
You don’t need to print anything. Just implement the given function.
1 <= T <= 10
1 <= N <= 10^5
1 <= X <= 10^9
‘DIR’ is an element of {‘LEFT’, ‘RIGHT’}
Time Limit: 1 sec
Function [int] rotateArray([int] A, int X, string DIR):