aoc2024/day-16/internal/one/solve.go

23 lines
284 B
Go
Raw Normal View History

2024-12-17 01:58:33 +00:00
package one
import (
"bytes"
)
2024-12-19 02:44:26 +00:00
var LowestCost int
2024-12-17 01:58:33 +00:00
func Solve(buf []byte) (int, error) {
r := bytes.NewReader(buf)
graph, err := parseLines(r)
if err != nil {
return 0, err
}
2024-12-19 02:44:26 +00:00
LowestCost, err = graph.dijkstra()
2024-12-17 01:58:33 +00:00
if err != nil {
return 0, err
}
2024-12-19 02:44:26 +00:00
return LowestCost, nil
2024-12-17 01:58:33 +00:00
}