ben
/
aoc
1
0
Fork 0

fix nullable warning for 2015 day 10
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Ben Harris 2022-12-10 23:56:33 -05:00
parent bd64911e67
commit 2df5764c99
1 changed files with 6 additions and 6 deletions

View File

@ -5,7 +5,7 @@ namespace AOC2015;
/// </summary>
public sealed class Day10 : Day
{
private string _seed;
private string? _seed;
public Day10() : base(2015, 10, "Elves Look, Elves Say")
{
@ -19,20 +19,20 @@ public sealed class Day10 : Day
public override object Part1()
{
for (var i = 0; i < 40; i++)
_seed = string.Concat(LookAndSay(_seed));
_seed = string.Concat(LookAndSay(_seed!));
return _seed.Length;
return _seed!.Length;
}
public override object Part2()
{
for (var i = 0; i < 10; i++)
_seed = string.Concat(LookAndSay(_seed));
_seed = string.Concat(LookAndSay(_seed!));
return _seed.Length;
return _seed!.Length;
}
public static IEnumerable<int> LookAndSay(string data)
private static IEnumerable<int> LookAndSay(string data)
{
var currentDigit = data[0];
int count = 1, place = 1;