Skip to content
C

Rotate an Array by K Positions

Mediumjavapythonccppjavascript

Given an array of N integers and an integer K, rotate the array to the right by K positions.

Input Format

The first line contains two integers N and K. The second line contains N space-separated integers.

Output Format

Print the rotated array as N space-separated integers on one line.

Input (stdin)

Output

Run your code to see output here...