Arrays: Left Rotation

  • + 0 comments

    this could easily be modified though by creating another array of the same size:

    vector b(n); for(int i = 0; i < n; i++) { b[i] = a[(i+k) % n]; } return b;