You are viewing a single comment's thread. Return to all comments →
Java Streams with better efficiency:
Deque<Integer> deque = new ArrayDeque<>(a); IntStream.rangeClosed(1, k).forEach(value -> { Integer last = deque.pollLast(); deque.addFirst(last); }); List<Integer> dequeList = new ArrayList<>(deque); return queries.stream() .map(dequeList::get) .collect(Collectors.toList());
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 →
Java Streams with better efficiency: