You are viewing a single comment's thread. Return to all comments →
hmm.. I'm surprised that worked for you. This one worked for me:
str = '' length_of_array.times do |i| new_index = (i + no_of_left_rotation) % length_of_array str += "#{array[new_index]} " end puts str.strip
Seems like cookies are disabled on this browser, please enable them to open this website
Arrays: Left Rotation
You are viewing a single comment's thread. Return to all comments →
hmm.. I'm surprised that worked for you. This one worked for me: