Code formatting and warning fixing.

This commit is contained in:
2024-12-01 17:36:23 +01:00
parent 9f8d966b7a
commit dafd2526d1
93 changed files with 739 additions and 823 deletions

View File

@@ -67,10 +67,7 @@ public class Day06 : IDay
foreach (char c in input)
{
if (groupMap.ContainsKey(c) == false)
{
groupMap.Add(c, true);
}
groupMap.TryAdd(c, true);
}
}
if (groupMap.Count > 0)
@@ -78,7 +75,7 @@ public class Day06 : IDay
groupMaps.Add(groupMap);
}
int total = groupMaps.Sum(groupMap => groupMap.Count);
int total = groupMaps.Sum(dict => dict.Count);
return total.ToString();
}
@@ -101,13 +98,9 @@ public class Day06 : IDay
groupCount++;
foreach (char c in input)
{
if (groupMap.ContainsKey(c) == false)
if (groupMap.TryAdd(c, 1) == false)
{
groupMap.Add(c, 1);
}
else
{
groupMap[c] = groupMap[c] + 1;
groupMap[c] += 1;
}
}
}