Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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