diff --git a/2024/src/Day06.fs b/2024/src/Day06.fs index 3966260..e35cb6a 100644 --- a/2024/src/Day06.fs +++ b/2024/src/Day06.fs @@ -1,5 +1,6 @@ namespace Aoc2024 +open System.Collections.Generic open Xunit open FsUnit.Xunit open Util @@ -122,7 +123,7 @@ module Day06 = distinctSteps |> should equal 5212 - [] + [] let ``part 02`` () = let max, obstructions, guard = getMap @@ -136,16 +137,16 @@ module Day06 = if obstructions.Contains(newObstruction) || newObstruction = guard.coord then None else - let alternativeObstructions = obstructions |> Set.add newObstruction + let alternativeObstructions = obstructions.Add newObstruction let alternativeSteps = getSteps max alternativeObstructions guard - let mutable alternativeGuardStepsSet: Set = Set.empty + let alternativeGuardStepsSet = HashSet() let findRepeat = alternativeSteps |> Seq.tryFind (fun alternativeStep -> let foundRepeatedStep = alternativeGuardStepsSet.Contains(alternativeStep) - alternativeGuardStepsSet <- alternativeGuardStepsSet |> Set.add alternativeStep + alternativeGuardStepsSet.Add alternativeStep |> ignore foundRepeatedStep) match findRepeat with