summary refs log blame commit diff stats
path: root/solutions/day1.fs
blob: 55616013ca4d5f05d5784e399483298c78dc956b (plain) (tree)
1
2
3
4
5
6
7

                     
 


                                             
 






                                   
 

                                                                          
module Solutions.Day1
open System.IO

let lines = File.ReadLines("inputs/day1.txt")
let totalWeights = seq {
    let mutable subseq = 0

    for line in lines do
    if line.Equals("") then
        yield subseq
        subseq <- 0
    else
        subseq <- subseq + int line
}

let part1 () = totalWeights |> Seq.max
let part2 () = totalWeights |> Seq.sortDescending |> Seq.take 3 |> Seq.sum