Answers for "arrays left rotation hackerrank solution"

C++
-1

arrays left rotation hackerrank solution

int n,d;
    cin>>n;
    int a[n];
    cin>>d;
    for(int i=0;i<n;cin>>a[i],i++);
    d=d%n;
    for(int i=d;i<n;i++)
        cout<<a[i]<<" ";
    
    for(int i=0;i<d;i++)
         cout<<a[i]<<" ";
    return 0;
Posted by: Guest on September-14-2020

Code answers related to "arrays left rotation hackerrank solution"

Browse Popular Code Answers by Language