You are viewing a single comment's thread. Return to all comments →
my java solution
public static List rotLeft(List a, int d) { // Write your code here
int prev=0; Queue<Integer> myQueue = new LinkedList<>(a); for(int i=0;i<d ; i++){ prev=myQueue.poll(); myQueue.add(prev); } List<Integer> list = new ArrayList<>( myQueue ); return list; }
Seems like cookies are disabled on this browser, please enable them to open this website
Arrays: Left Rotation
You are viewing a single comment's thread. Return to all comments →
my java solution
public static List rotLeft(List a, int d) { // Write your code here