From a8c844a12fa2d91410fda7b37f08c58f5be34ed9 Mon Sep 17 00:00:00 2001 From: Tomasz Chojnacki Date: Sat, 17 Dec 2022 21:14:53 +0100 Subject: Finish day 16 --- aoc-2022-dotnet/Common/Util.fs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'aoc-2022-dotnet/Common') diff --git a/aoc-2022-dotnet/Common/Util.fs b/aoc-2022-dotnet/Common/Util.fs index 436e9a0..acf89af 100644 --- a/aoc-2022-dotnet/Common/Util.fs +++ b/aoc-2022-dotnet/Common/Util.fs @@ -42,11 +42,9 @@ module Util = let notIn set element = not <| Set.contains element set - let maxOrZero seq = - if Seq.isEmpty seq then - 0 - else - Seq.max seq + let updateMax key newValue map = + map + |> Map.add key (max newValue (map |> Map.tryFind key |> Option.defaultValue 0)) let rec insertSorted x = function -- cgit v1.2.3