[codility] CyclicRotation
[codility] CyclicRotation CyclicRotation.js const assert = require('assert'); function solution(A, K) { const shiftedArray = []; let shiftedIndex; A.forEach((element, index) => { shiftedIndex = (index + K) % A.length;// 오른쪽으로 shift shiftedArray[shiftedIndex] = A[index]; }); return shiftedArray; } describe('Test Suite', () => { it('case 1', () => { assert.deepEqual([9, 7, 6, 3, 8], solution([3, 8..
2019. 3. 14.