# R-r-riddikulus! once again

Problem:-

“R-r-riddikulus”  used in the movie Harry Potter to transform anything from one form to other, Similarly you have to transform the array by rotation.

left rotation operation on an array shifts each of the array’s elements 1 unit to the left. For example, if 2  left rotations are performed on array [1,2,3,4,5], then the array would become [3,4,5,1,2].

Given an array a of n integers and a number, d, perform d left rotations on the array. Return the updated array to be printed as a single line of space-separated integers.

Input Format

The first line contains two space-separated integers n and d, the size of a and the number of left rotations you must perform.
The second line contains space-separated integers a[i] .

Constraints

• $1<=n<={10}^{5}$

• $1<=d<=n$

• $1<=a\left[i\right]<={10}^{6}$

Output Format

Print a single line of n space-separated integers denoting the final state of the array after performing  left rotations.

Sample Input
`5 41 2 3 4 5`
Sample Output
`5 1 2 3 4`
Time Limit: 5
Memory Limit: 256
Source Limit:
Explanation

When we perform d=4 left rotations, the array undergoes the following sequence of changes:

$\left[1,2,3,4,5\right]->\left[2,3,4,5,1\right]->\left[3,4,5,1,2\right]->\left[4,5,1,2,3\right]->\left[5,1,2,3,4\right]$

Code:-

#include<stdio.h>
int main()
{
long int n,d,i,j;
scanf(“%ld%ld”,&n,&d);
long long int a[n];
for(i=0;i<n;i++)
{
scanf(“%lld”,&a[i]);
}
for(j=0;j<d;j++)
{
int temp;
temp=a[0];
for(i=0;i<n1;i++)
{
a[i]=a[i+1];
}
a[i]=temp;

}
for(i=0;i<n;i++)
printf(“%lld “,a[i]);
return 0;
}