You are viewing a single comment's thread. Return to all comments →
My C solution was similar:
int main() { int n; int d; int temp; int *array = (int *)malloc(sizeof(int) * n); scanf("%d", &n); scanf("%d", &d); for(int i = 0; i < n; i++){ temp = i - d; if(temp < 0){ temp = temp + n; } scanf("%d", &array[temp]); } for(int i = 0; i < n; i++){ printf("%d ", array[i]); } return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Left Rotation
You are viewing a single comment's thread. Return to all comments →
My C solution was similar: