mirror of
https://github.com/onyx-and-iris/aoc2024.git
synced 2026-04-09 02:23:36 +00:00
use already calculated one.LowestCost
This commit is contained in:
@@ -4,6 +4,8 @@ import (
|
||||
"bytes"
|
||||
)
|
||||
|
||||
var LowestCost int
|
||||
|
||||
func Solve(buf []byte) (int, error) {
|
||||
r := bytes.NewReader(buf)
|
||||
graph, err := parseLines(r)
|
||||
@@ -11,10 +13,10 @@ func Solve(buf []byte) (int, error) {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
lowestCost, err := graph.dijkstra()
|
||||
LowestCost, err = graph.dijkstra()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return lowestCost, nil
|
||||
return LowestCost, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user