-
-
Save MrPanch/04cebde3d8028586cea8823438db99c5 to your computer and use it in GitHub Desktop.
Revisions
-
MrPanch created this gist
Oct 8, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ n = int(input()) k = int(input()) direction = input() a = [] for i in range(n): a.append(int(input())) result = [0] * n k %= n if direction == "LEFT": k = n - k result[k] = a[0] i = 1 j = k+1 while j != k: result[j] = a[i] i += 1 j = (j + 1) % n print(result)