Problem Description

Rotate array to the right by k steps, in-place idea using gcd cycles. Print rotated array.

Input Format

Line1: n k. Line2: n integers.

Output Format

One line: rotated array.

Sample Test Case

Input:
7 3 1 2 3 4 5 6 7
Output:
5 6 7 1 2 3 4

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next