You are viewing a single comment's thread. Return to all comments →
Similarly:
public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int d = sc.nextInt(); int array[] = new int[n]; for (int i=0; i<n; i++) { array[i] = sc.nextInt(); } for (int i=0; i<n; i++) { System.out.print(array[(i+d)%n] + " "); } }
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 →
Similarly: