Earlier provided solution is returning [7, 6, 3, 8, 9] whereas expected is [9, 7, 6, 3, 8]. Seems like logic is not working well. Here is the correct working code:
def solution(A, K):
K = (K % len(A))
return A[len(A) - K:] + A[:len(A) - K]
pass