Created
October 2, 2020 13:40
-
-
Save page2me/3bb36597f7e1c9b01168fcb73fd9c58d to your computer and use it in GitHub Desktop.
HackerRank - Circular Array Rotation
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 characters
| #!/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