You are viewing a single comment's thread. Return to all comments →
Well done! I did it by finding the correct number for the index, rather than the new position of a given number:
for (int i =0; i < n; i++){ int num = a[((n + k) % n + i) % n]; System.out.print((num) + " "); }
Arrays: Left Rotation
You are viewing a single comment's thread. Return to all comments →
Well done! I did it by finding the correct number for the index, rather than the new position of a given number: