Skip to content

Instantly share code, notes, and snippets.

@liammclennan
Created March 16, 2017 11:15
Show Gist options
  • Save liammclennan/5a7d101d1d0e73f0a02b1ce2167964c4 to your computer and use it in GitHub Desktop.
Save liammclennan/5a7d101d1d0e73f0a02b1ce2167964c4 to your computer and use it in GitHub Desktop.
Hackerrank: Arrays: Left Rotation
let rotations = System.Console.ReadLine().Split().[1] |> int
let vals = System.Console.ReadLine().Split()
let rotate arr n =
let cut = n % Array.length arr
Array.append arr.[cut..] arr.[..cut-1]
String.concat " " (rotate vals rotations) |> printfn "%s"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment