-
-
Save dahlbyk/6618291 to your computer and use it in GitHub Desktop.
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
open System; | |
open System.Diagnostics; | |
[<EntryPoint>] | |
let main argv = | |
let rec cc amount coins = | |
match (amount, coins) with | |
| (0,_) -> 1 | |
| (_,[]) -> 0 | |
| (amount,_) when amount < 0 -> 0 | |
| _ -> cc amount coins.Tail + cc (amount-coins.Head) coins | |
let stopWatch = Stopwatch.StartNew() | |
let x = cc 100 [1;2;3;4;5;6;7] | |
stopWatch.Stop(); | |
printfn "elapsed: %f" stopWatch.Elapsed.TotalMilliseconds | |
Console.ReadLine() |> ignore | |
0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment