lesson 2. cyclicrotation

결과 위치는 (현재 인덱스 + 이동한 횟수) % 배열 길이로 구하고 배열에 (이동된 결과 위치, 현재 값)을 집어넣은 후 정렬하여 인덱스 순서대로 값이 나오도록 구현했다 # you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(A, K): temp=[] for i,a in enumerate(A): temp.append(((i+K)%len(A),a)) temp.sort() ans=[] for i,j in temp: ans.append(j) return ans 이렇게 슬라이싱으로 푸는 방법도 있다 def solution(A, K): # write your code in Python ..