You are viewing a single comment's thread. Return to all comments →
See What is Actually happening
import java.util.*; public class Main { public static void main(String args[]) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(),k=sc.nextInt(),q=sc.nextInt(); int arr[]=new int[n]; for(int i=0;i<n;i++) { arr[i]=sc.nextInt(); } int arr1[]=new int[n]; k=k%n; for(int i=0;i<n;i++) { arr1[i]=arr[(i+(n-k))%n]; } while(q-->0) { int qq=sc.nextInt(); System.out.println(arr1[qq]); } } } </code>
Seems like cookies are disabled on this browser, please enable them to open this website
Circular Array Rotation
You are viewing a single comment's thread. Return to all comments →
See What is Actually happening