Skip to content

Instantly share code, notes, and snippets.

@juanfurattini
Created August 29, 2018 02:29
Show Gist options
  • Save juanfurattini/458c4bd6968c2991691248eccbe289a2 to your computer and use it in GitHub Desktop.
Save juanfurattini/458c4bd6968c2991691248eccbe289a2 to your computer and use it in GitHub Desktop.
def solution(a, k)
return a if a.empty? || k.zero?
k = k.modulo(a.size) if k > a.size
a.unshift(*a.pop(k))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment