• + 0 comments

    And here is my solution in C, avoiding any actual rotation and the time and possibly memory hit that would incur:

    for (int j = 0; j < n; j++)
    {
        if (j+d < n)
            printf ("%d ",*(a+j+d));
        else
            printf ("%d ",*(a+j-(n-d)));
    }
    printf("\n");