Refactor 2026 Day06 BFS initialization order
This commit is contained in:
1 parent
1faf120a47
commit
170bab3c29
1 file changed
+2
-2
+2
-2
@@ -106,8 +106,8 @@ public class Day06 : IPuzzleSolver<string>
|
|||||||
private static int GetMinDistanceTo(string from, string to, Dictionary<string, HashSet<string>> gridInstructions)
|
private static int GetMinDistanceTo(string from, string to, Dictionary<string, HashSet<string>> gridInstructions)
|
||||||
{
|
{
|
||||||
var queue = new Queue<(string, int)>();
|
var queue = new Queue<(string, int)>();
|
||||||
queue.Enqueue((from, 0));
|
|
||||||
var seen = new HashSet<string>();
|
var seen = new HashSet<string>();
|
||||||
|
queue.Enqueue((from, 0));
|
||||||
while (queue.Count > 0)
|
while (queue.Count > 0)
|
||||||
{
|
{
|
||||||
var (current, distance) = queue.Dequeue();
|
var (current, distance) = queue.Dequeue();
|
||||||
@@ -137,8 +137,8 @@ public class Day06 : IPuzzleSolver<string>
|
|||||||
{
|
{
|
||||||
var maxDistance = 0;
|
var maxDistance = 0;
|
||||||
var queue = new Queue<(string, int)>();
|
var queue = new Queue<(string, int)>();
|
||||||
queue.Enqueue((from, 0));
|
|
||||||
var seen = new HashSet<string>();
|
var seen = new HashSet<string>();
|
||||||
|
queue.Enqueue((from, 0));
|
||||||
while (queue.Count > 0)
|
while (queue.Count > 0)
|
||||||
{
|
{
|
||||||
var (current, distance) = queue.Dequeue();
|
var (current, distance) = queue.Dequeue();
|
||||||
|
|||||||
Reference in new issue
Block a user