You are viewing a single comment's thread. Return to all comments →
This is my solution in Java
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++) { array[(i+n-d)%n] = 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 →
This is my solution in Java