Skip to content

Commit

Permalink
Update Solution.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
encse authored Dec 5, 2024
1 parent a7eb491 commit e8ecba9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion 2024/Day05/Solution.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ public object PartTwo(string input) {
var updates = parts[1].Split("\n").Select(line => line.Split(",")).ToArray();
return (updates, comparer);
}

int GetMiddlePage(string[] nums) => int.Parse(nums[nums.Length / 2]);

bool Sorted(string[] pages, Comparer<string> comparer) =>
Enumerable.SequenceEqual(pages, pages.OrderBy(x=>x, comparer));

}
}

0 comments on commit e8ecba9

Please sign in to comment.