Circular Array Rotation C++ HackerRank
Rather than performing a rotation k times, perform one rotation of k places.

So, you have an array [5, 4, 3, 2, 1] and want to rotate it 3 places:


Create a new array containing the results
Start iterating through the array, calculating the index in the new array and assigning the values
Starts at i = 0 (value 5). Wants a rotation of 3, so newArray[i + k] = array[i]
Continues this up to i = 2, where we find a hitch: newArray[i + k] = array[i], a.k.a. newArray[5] = array[2], so out of bounds. Uh oh!
We must make the assignment cycle around, so we must use mod with the size of the array to produce a single iteration over the initial array with this: newArray[(i + k) % n] = array[i]