Left Rotation

  • + 0 comments

    Java Easy solution

    public static List<Integer> rotateLeft(int d, List<Integer> arr) {
    
        if(d==arr.size()){
            return arr;
        }
        int i=0;
        for(;i<d;d--){
            int temp = arr.get(i);
            arr.remove(i);
            arr.add(temp);
        }
        return arr;
    }