You are viewing a single comment's thread. Return to all comments →
Good thinking! I guess it could be handled with another array logically. My two cents.
...... int[] getArray = new int[n]; for (int i = 0; i < n; i++) { getArray[i] = scan.next(); } for (int i = 0; i < n; i++) { array[(i + n - d) % n] = getArray [i]; } for(int i = 0; i < n; i++) { System.out.print(array[i] + " "); }
Left Rotation
You are viewing a single comment's thread. Return to all comments →
Good thinking! I guess it could be handled with another array logically. My two cents.