The task is to rotate left or rotate right a subarray of an array given number of times.
Let me explain this on an example:
There's a trick to this. It's pretty weird that you'd get this for homework if the trick wasn't mentioned in class. Anyway...
To rotate a sequence of N elements left by M:
done
e.g. left by 2: 1234567 -> 7654321 -> 7654312 -> 3456712