Last active
December 5, 2022 15:08
-
-
Save Gorcenski/cad1435ac25895f32213fbc81bc73742 to your computer and use it in GitHub Desktop.
Advent of Code 2022 Day 1
This file contains hidden or 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.IO | |
let readLines (filePath:string) = | |
use sr = new StreamReader (filePath) | |
sr.ReadToEnd().Split([|"\n\n"|],System.StringSplitOptions.TrimEntries) | |
|> Seq.map (fun x -> x.Split [|'\n'|]) | |
|> Seq.map (Seq.map (int)) | |
|> Seq.map Seq.sum | |
|> Seq.sortDescending | |
let results = "data/day1.txt" |> readLines |> List.ofSeq | |
results.[0..2] |> List.sum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment