rotateArrayByN 🌶️🌶️
Write a method that takes an int array, nums, and an int, n, and returns a new int array with every element shifted n positions to the left, wrapping around to the end (the same direction as rotateArrayLeft, generalized to any number of positions instead of exactly one). For example, rotateArrayByN({1, 2, 3, 4, 5}, 2) should return {3, 4, 5, 1, 2}.
Precondition: 0 <= n < nums.length.
Where did the value at each position in the result originally sit? What happens once that position runs past the end of the array?
Is it easier to build a brand new array, or shift elements around inside the original?