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 to array [n].
thanks. Got it.
That's what I was thinking, too. The easiest solution to the expected output isn't necessarily solving the stated problem. But, that's also the nature of the problems. Perhaps a better problem would be one that simply passed in an array and you had to modify said array in place. That would at least ensure the right problem is being solved.