class Solution {
public int[] solution(int[] A, int K) {
for (int a = 0; a <= K; a++) {
for (int j = 0; j < A.length - 1; j++) {
A[j + 1] = A[j];
A[0] = A[A.length];
}
}
return A;
}
}
What is wrong with this code? The next integer should be assigned the value of the previous one and the first one the value of the last one.