Codility – CyclicRotation 문제 풀이 (난이도 : 하)
문제 유출은 안된다니 풀이만……
class Solution {
public int[] solution(int[] A, int K) {
// write your code in Java SE 8
int[] a = new int[A.length];
for(int i = 0 ; i < A.length ; i++){
a[(i+K)%a.length] = A[i];
}
return a;
}
}
3544 Total Views 1 Views Today