You are viewing a single comment's thread. Return to all comments →
Pretty smart, but are you sure you are not copying the kth eleement, in ruby it would be:
k
def array_left_rotation(a, k) a[k..-1] + a[0...k] end
In ruby, ... means excluding the right number.
...
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 →
Pretty smart, but are you sure you are not copying the
k
th eleement, in ruby it would be:In ruby,
...
means excluding the right number.