• + 0 comments

    Hi akueisara39 : i appreciate your code as it appears to be out of box solution . but i feel it throws an exception when the number of shift operations is greater than the size(d>n) of the array so just added few lines of code to it .

    int[] array = new int[n]; if(d>n) d=d%n; for(int i=0; i array[(i+n-d)%n] = scan.nextInt();
    }