Update day 15 solution
All checks were successful
continuous-integration/drone/push Build is passing

Don't neet to remember the path
This commit is contained in:
2021-12-15 18:17:35 +01:00
parent d353c3555e
commit a3becde292

View File

@@ -11,7 +11,6 @@ def part_1(input):
start = (0, 0)
end = (x_size - 1, y_size - 1)
cost = {start: 0}
prev = {start: None}
queue = set([start])
done = set()
neighbors = set([(-1, 0), (0, -1), (0, 1), (1, 0)])
@@ -32,7 +31,6 @@ def part_1(input):
next_cost = cur_cost + nodes[n]
if not n in cost or next_cost < cost[n]:
cost[n] = next_cost
prev[n] = current
queue.add(n)
done.add(current)
result = cost[end]
@@ -58,7 +56,6 @@ def part_2(input):
start = (0, 0)
end = ((x_size * repeat) - 1, (y_size * repeat) - 1)
cost = {start: 0}
prev = {start: None}
queue = set([start])
done = set()
neighbors = set([(-1, 0), (0, -1), (0, 1), (1, 0)])
@@ -81,7 +78,6 @@ def part_2(input):
next_cost = cur_cost + nodes[n]
if not n in cost or next_cost < cost[n]:
cost[n] = next_cost
prev[n] = current
queue.add(n)
done.add(current)
result = cost[end]