Fix Day04 pattern repair to avoid mutating original pattern
This commit is contained in:
1 parent
3781e28851
commit
7a66eaa0e1
1 file changed
+1
-1
+1
-1
@@ -52,7 +52,7 @@ public class Day04 : IPuzzleSolver<long>
|
||||
|
||||
private static bool TryRepairPattern(char[] pattern, char[] barcodeChunk, out char[] repairedPattern)
|
||||
{
|
||||
repairedPattern = pattern;
|
||||
repairedPattern = [..pattern];
|
||||
for (var i = 0; i < pattern.Length && i < barcodeChunk.Length; i++)
|
||||
{
|
||||
if(pattern[i] == barcodeChunk[i])
|
||||
|
||||
Reference in new issue
Block a user