Arrays: Left Rotation

  • + 3 comments

    Java

    public static List rotLeft(List a, int d) { while(d>0) { Integer removed = a.remove(0); a.add(removed); d--; } return a; } }