Skip to content

Instantly share code, notes, and snippets.

@page2me
Created October 2, 2020 13:40
Show Gist options
  • Save page2me/3bb36597f7e1c9b01168fcb73fd9c58d to your computer and use it in GitHub Desktop.
Save page2me/3bb36597f7e1c9b01168fcb73fd9c58d to your computer and use it in GitHub Desktop.
HackerRank - Circular Array Rotation
#!/usr/bin/env python
def line_int():
return [int(x) for x in input().split(' ')]
def main():
(n, k, q) = line_int()
arr = line_int()
r = k%n
for j in range(q):
m = int(input())
i = (m - r)
print (arr[i if i >= 0 else i + n])
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment