public char[] rotateString(char[] A, int offset) {
        // wirte your code here
        if (A == null || A.length < 1)
            return A;
        offset = offset % A.length;
        if (offset == 0)
            return A;
        rotate(A, 0, A.length - offset - 1);
        rotate(A, A.length - offset, A.length - 1);
        rotate(A, 0, A.length - 1);
        return A;
    }