TheAlgorithms-C/leetcode/src/189.c

11 lines
253 B
C
Raw Normal View History

void rotate(int* nums, int numsSize, int k){
for(int i = 1; i <= k; i++){
int j;
int lastElement;
lastElement = nums[numsSize - 1];
for(j = numsSize - 1; j > 0; j--){
nums[j] = nums[j - 1];
}
nums[0] = lastElement;
}
}