We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
publicstaticList<Integer>rotateLeft(intd,List<Integer>arr){// Write your code hereList<Integer>res=newArrayList<>();List<Integer>temp=newArrayList<>();introt=d%arr.size();if(rot==0){returnarr;}for(inti=0;i<rot;i++){temp.add(arr.get(i));}for(inti=rot;i<arr.size();i++){res.add(arr.get(i));}res.addAll(temp);returnres;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Left Rotation
You are viewing a single comment's thread. Return to all comments →
Java Code: