public void rotate(int[] a, int k) {
        k %= a.length;
        reverse(a, 0, a.length - 1);
        reverse(a, 0, k - 1);
        reverse(a, k, a.length - 1);
    }
The idea is simple. First we will reverse all array elements. Then do another reversion of elements
up to given kth-1 index and the of part of the array. Voila! rotated :)
Time complexity is O(N) + O(N) = O(N);
src/problems/easy/RotateArray.java