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.
There are a lot of people solving the problem this way. Reread the problem statement and you'll see that this doesn't do what was asked. There only prints out the input in the order expected after a left rotation d times. The real problem is left rotating an existing array and then print the final content of the array. So what you need to do is read in your input and then store it into an unsorted, unrotated, etc array. Left shift that array, and then print it out from array[0] to array [n].
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 →
There are a lot of people solving the problem this way. Reread the problem statement and you'll see that this doesn't do what was asked. There only prints out the input in the order expected after a left rotation d times. The real problem is left rotating an existing array and then print the final content of the array. So what you need to do is read in your input and then store it into an unsorted, unrotated, etc array. Left shift that array, and then print it out from array[0] to array [n].