use already calculated one.LowestCost

This commit is contained in:
2024-12-19 02:44:26 +00:00
parent 17f2bc8223
commit f1cac7da7b
2 changed files with 9 additions and 9 deletions

View File

@@ -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
}