• + 0 comments

    Java

    public static List<Integer> rotateLeft(int d, List<Integer> arr) {
            Queue<Integer> q = new ArrayDeque<>(arr);
    
            while(d > 0){
                int data = q.poll();
                q.offer(data);
                d--;
            }
    
            return new ArrayList<>(q);
        }