Compare commits
4 Commits
1ac8cee3d5
...
1214dcadfe
| Author | SHA1 | Date | |
|---|---|---|---|
| 1214dcadfe | |||
| e93bf9ecd7 | |||
| 4cf8f15e14 | |||
| 633a9d9248 |
@@ -20,6 +20,10 @@
|
|||||||
<Content Include="Input\DayTwo.txt">
|
<Content Include="Input\DayTwo.txt">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<None Remove="Input\DayThree.txt" />
|
||||||
|
<Content Include="Input\DayThree.txt">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
35
AdventOfCode2025/Lobby.cs
Normal file
35
AdventOfCode2025/Lobby.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
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 first = '0';
|
||||||
|
var second = '0';
|
||||||
|
for (var i = 0; i < line.Length; i++)
|
||||||
|
{
|
||||||
|
if (i != line.Length - 1 && line[i] > first)
|
||||||
|
{
|
||||||
|
first = line[i];
|
||||||
|
second = line[i + 1];
|
||||||
|
}
|
||||||
|
else if (line[i] > second)
|
||||||
|
{
|
||||||
|
second = line[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
total += int.Parse($"{first}{second}");
|
||||||
|
}
|
||||||
|
|
||||||
|
return new AdventSolution(total.ToString(), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,4 +6,7 @@ var dayOneInput = await File.ReadAllTextAsync("./Input/DayOne.txt");
|
|||||||
AdventSolver<SecretEntrance>.Solve(dayOneInput, 1, "Secret Entrance");
|
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/DayThree.txt");
|
||||||
|
AdventSolver<Lobby>.Solve(dayThreeInput, 3, "Lobby");
|
||||||
@@ -1,10 +1,12 @@
|
|||||||
namespace AdventOfCode2025;
|
using AdventOfCode2025.Utils;
|
||||||
|
|
||||||
|
namespace AdventOfCode2025;
|
||||||
|
|
||||||
public class SecretEntrance : IAdventSolution
|
public class SecretEntrance : IAdventSolution
|
||||||
{
|
{
|
||||||
public AdventSolution Solve(string input)
|
public AdventSolution Solve(string input)
|
||||||
{
|
{
|
||||||
var lines = input.Split('\n', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
|
var lines = input.SplitLines();
|
||||||
|
|
||||||
var current = 50;
|
var current = 50;
|
||||||
var password = 0;
|
var password = 0;
|
||||||
|
|||||||
9
AdventOfCode2025/Utils/StringExtensions.cs
Normal file
9
AdventOfCode2025/Utils/StringExtensions.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace AdventOfCode2025.Utils;
|
||||||
|
|
||||||
|
public static class StringExtensions
|
||||||
|
{
|
||||||
|
public static string[] SplitLines(this string input)
|
||||||
|
{
|
||||||
|
return input.Split('\n', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user