Simple mod Solution in C


#1

int* rotateArray(int* A, int n1, int B, int *len) {
int *ret = (int *)malloc(n1 * sizeof(int));
*len = n1;
int i;
for (i = 0; i < n1; i++){
ret[i] = A[(i + B)%n1];
}
return ret;
}