Skip to content

Instantly share code, notes, and snippets.

@MrPanch
Created October 8, 2021 17:14
Show Gist options
  • Save MrPanch/04cebde3d8028586cea8823438db99c5 to your computer and use it in GitHub Desktop.
Save MrPanch/04cebde3d8028586cea8823438db99c5 to your computer and use it in GitHub Desktop.

Revisions

  1. MrPanch created this gist Oct 8, 2021.
    22 changes: 22 additions & 0 deletions a.py
    Original 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)