Check out example codes for "arrays left rotation hackerrank solution". It will help you in understanding the concepts better.

Code Example 1

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;

Learn ReactJs, React Native from akashmittal.com