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.
I'm failing to see where it actually does a left rotate of an existing array.
What I'm seeing is (from assumption of ...)
array[0..n] is empty initially.
getArray[0..n] stores input from stdin.
store rotated result into array[0..n].
The existing array is getArray. That array is still in an unrotated order. The array[0..n] isn't considered the exiting array as it is empty.
Challenge to you: get rid of getArray array and store input into array[] array. Rotate that array and then print the end result of that array.
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 →
I'm failing to see where it actually does a left rotate of an existing array.
What I'm seeing is (from assumption of ...) array[0..n] is empty initially. getArray[0..n] stores input from stdin. store rotated result into array[0..n].
The existing array is getArray. That array is still in an unrotated order. The array[0..n] isn't considered the exiting array as it is empty.
Challenge to you: get rid of getArray array and store input into array[] array. Rotate that array and then print the end result of that array.