You are viewing a single comment's thread. Return to all comments →
It is a greate solution.
I think something similar, but your solution is better.
Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int d = scanner.nextInt() % n; int arr[] = new int[n]; for (int i = 0; i < n; i++) { arr[i] = scanner.nextInt(); } scanner.close(); for (int i = d; i < n; i++) { System.out.print(arr[i]); System.out.print(' '); } for (int i = 0; i < d; i++) { System.out.print(arr[i]); System.out.print(' '); } System.out.println();
Seems like cookies are disabled on this browser, please enable them to open this website
Left Rotation
You are viewing a single comment's thread. Return to all comments →
It is a greate solution.
I think something similar, but your solution is better.