Created
December 1, 2020 18:56
-
-
Save andredublin/52a997694500d9d25047e1b4025b3ebd to your computer and use it in GitHub Desktop.
Advent of code 2020
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
Day 1 | |
let solve () = | |
let list = File.ReadLines("input.txt") |> Seq.map (fun str -> (int str)) |> Seq.toArray | |
let rec loop n rest= | |
let found = list |> Array.tryFind(fun value -> value + n = 2020) | |
if found.IsSome then printfn "%A" (found.Value * n) | |
else loop (Array.head rest) (Array.tail rest) | |
loop (Array.head list) (Array.tail list) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment