You are viewing a single comment's thread. Return to all comments →
Here is my solution for this problem(java,javascript)
https://webdev99.com/left-rotationproblem-solving-data-structures/
for detailed solution checkout above article
javascript:
for(var i=d;i<arr.length;i++) arr.unshift(arr.pop()); return arr;
Java:
d = d%arr.size(); int x; for(int i=0;i<d;i++){ x=arr.get(0); arr.remove(arr.get(0)); arr.add(x); } return arr;
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 →
Here is my solution for this problem(java,javascript)
https://webdev99.com/left-rotationproblem-solving-data-structures/
for detailed solution checkout above article
javascript:
Java: