From 30a12939320a2c95c570e434ebf793c174ba5701 Mon Sep 17 00:00:00 2001 From: login000 Date: Tue, 3 Dec 2024 14:37:19 +1030 Subject: [PATCH] Day2 fix - thank you elly --- Advent24/Day2.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Advent24/Day2.cs b/Advent24/Day2.cs index 8301af7..1964049 100644 --- a/Advent24/Day2.cs +++ b/Advent24/Day2.cs @@ -13,7 +13,6 @@ namespace Advent24 { Int32 currentLevel; Int32? previousLevel = null; - Int32? previousPreviousLevel = null; Int32 differenceInLevels = 0; Boolean? isIncreasing = null; Boolean reportIsSafe = true; @@ -29,8 +28,7 @@ namespace Advent24 if((levelIndexToSkip ?? -1) == currentLevelIndex) { // assume current element doesn't exist, so the previous - // element should be the one that was before it - previousLevel = previousPreviousLevel; + // element should remain what it was Console.WriteLine("{0:s} {1:d}", " currentLevelIndex (skipped) = ", currentLevelIndex); @@ -96,8 +94,7 @@ namespace Advent24 // control reaches this line if report has not been proven unsafe yet - // updating previousLevel and previousPreviousLevel in preparation for the next iteration - previousPreviousLevel = previousLevel; + // updating previousLevel in preparation for the next iteration previousLevel = currentLevel; // incrementing the current-element-number indicator