View Code of Problem 79

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] arr1 = new int[n];
        int[] arr2 = new int[n];

        for(int i = 0; i < n; i ++) {
            arr1[i] = sc.nextInt();
        }

        int m = sc.nextInt();
        for(int i = 0; i < n; i ++) {
            arr2[(i + m) % n] = arr1[i];
        }
        for(int i = 0; i < n; i ++) {
            System.out.print(arr2[i] + " ");
        }
    }
}

Double click to view unformatted code.


Back to problem 79