fix: Fixed Day 2 - part 2 not working yet
This commit is contained in:
@@ -29,7 +29,6 @@ Console.WriteLine(levelsSafe);
|
||||
|
||||
bool TestLevel(LinkedList<int> linkedList)
|
||||
{
|
||||
int unsafeCount = 0;
|
||||
var node = linkedList.First;
|
||||
List<LevelDirection> directions = new List<LevelDirection>();
|
||||
while (node != null)
|
||||
@@ -47,7 +46,7 @@ bool TestLevel(LinkedList<int> linkedList)
|
||||
|
||||
if(safeRange is false)
|
||||
{
|
||||
unsafeCount++;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (node.Next is not null)
|
||||
@@ -61,8 +60,7 @@ bool TestLevel(LinkedList<int> linkedList)
|
||||
bool allIncreasing = directions.All(x => x == LevelDirection.Increasing);
|
||||
bool allDecreasing = directions.All(x => x == LevelDirection.Decreasing);
|
||||
|
||||
Console.Write($" {unsafeCount}|{allIncreasing}|{allDecreasing} ");
|
||||
return ((allIncreasing || allDecreasing) && unsafeCount == 0) || (allIncreasing == false && allDecreasing == false);
|
||||
return allIncreasing || allDecreasing;
|
||||
|
||||
bool InsideRange(int current, int target)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user