Created
March 16, 2017 11:15
-
-
Save liammclennan/5a7d101d1d0e73f0a02b1ce2167964c4 to your computer and use it in GitHub Desktop.
Hackerrank: Arrays: Left Rotation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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