You are viewing a single comment's thread. Return to all comments →
If you're looking for something more easy to understand:
public class Solution { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int d = scan.nextInt(); int[] array = new int[n]; for(int i=0; i<n;i++) { if(i-d < 0) array[n+(i-d)] = scan.nextInt(); else array[i-d] = scan.nextInt(); } for(int i=0; i<n;i++) { System.out.print(array[i] + " "); } } }
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 →
If you're looking for something more easy to understand: