You are viewing a single comment's thread. Return to all comments →
Simple Java solution without additional list
int size = a.size(); k=k%size; List<Integer> res = new ArrayList<>(); for(int i:queries){ int idx = i-k; if(idx<0) idx+=size; res.add(a.get(idx)); } return res;
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 →
Simple Java solution without additional list