part 1 brute forced

This commit is contained in:
2025-12-03 13:06:55 -05:00
parent 4cf8f15e14
commit e93bf9ecd7
2 changed files with 30 additions and 1 deletions

29
AdventOfCode2025/Lobby.cs Normal file
View File

@@ -0,0 +1,29 @@
using System.Runtime.InteropServices.JavaScript;
using AdventOfCode2025.Utils;
namespace AdventOfCode2025;
public class Lobby : IAdventSolution
{
public AdventSolution Solve(string input)
{
var lines = input.SplitLines();
var total = 0;
foreach (var line in lines)
{
var max = 0;
for (var i = 0; i < line.Length; i++)
{
for (var j = i + 1; j < line.Length; j++)
{
var num = int.Parse(line[i].ToString() + line[j].ToString());
if (num > max) max = num;
}
}
total += max;
}
return new AdventSolution(total.ToString(), null);
}
}

View File

@@ -8,5 +8,5 @@ AdventSolver<SecretEntrance>.Solve(dayOneInput, 1, "Secret Entrance");
var dayTwoInput = await File.ReadAllTextAsync("./Input/DayTwo.txt"); var dayTwoInput = await File.ReadAllTextAsync("./Input/DayTwo.txt");
AdventSolver<GiftShop>.Solve(dayTwoInput, 2, "Gift Shop"); AdventSolver<GiftShop>.Solve(dayTwoInput, 2, "Gift Shop");
var dayThreeInput = await File.ReadAllTextAsync("./Input/Test.txt"); var dayThreeInput = await File.ReadAllTextAsync("./Input/DayThree.txt");
AdventSolver<Lobby>.Solve(dayThreeInput, 3, "Lobby"); AdventSolver<Lobby>.Solve(dayThreeInput, 3, "Lobby");