Skip to content

Instantly share code, notes, and snippets.

@andredublin
Created December 1, 2020 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andredublin/52a997694500d9d25047e1b4025b3ebd to your computer and use it in GitHub Desktop.
Save andredublin/52a997694500d9d25047e1b4025b3ebd to your computer and use it in GitHub Desktop.
Advent of code 2020
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