part 1 brute forced
This commit is contained in:
29
AdventOfCode2025/Lobby.cs
Normal file
29
AdventOfCode2025/Lobby.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
@@ -8,5 +8,5 @@ AdventSolver<SecretEntrance>.Solve(dayOneInput, 1, "Secret Entrance");
|
||||
var dayTwoInput = await File.ReadAllTextAsync("./Input/DayTwo.txt");
|
||||
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");
|
||||
Reference in New Issue
Block a user