We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
i actually tried running the code in eclipse, and it is matching the expected output, expect in the last case where it doesnot return the result before enter is pressed, as when the return key is pressed the output becomes fully correct.
here is my code----------------------
import java.io.;
import java.util.;
public class Solution {
public static void main(String[] args) {
Scanner s1=new Scanner(System.in);
int n=s1.nextInt();
int k=s1.nextInt();
int q=s1.nextInt();
int a[]=new int[n];
for(int i=0;i<n;i++)
{
a[i]=s1.nextInt();
}
for(int i=0;i<q;i++)
{
int m=s1.nextInt();
System.out.println(a[(n-k+m)%n]);
}
}
}
Cookie support is required to access HackerRank
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 →
i actually tried running the code in eclipse, and it is matching the expected output, expect in the last case where it doesnot return the result before enter is pressed, as when the return key is pressed the output becomes fully correct.
here is my code----------------------
import java.io.; import java.util.;
public class Solution {
}