Solution for Day 9

This commit is contained in:
2021-12-09 19:52:34 +00:00
parent b62022ff07
commit 156eb5f2de
7 changed files with 367 additions and 0 deletions

24
nine/main.go Normal file
View File

@@ -0,0 +1,24 @@
package nine
import "fmt"
type Nine struct {
vents vents
}
func Init(filepath string) *Nine {
nine := &Nine{
vents: vents{},
}
nine.vents.load(filepath)
return nine
}
func (d *Nine) Answer() string {
return fmt.Sprintf("The sum of the risk level of low points is %d", d.vents.sumLowPointRisk())
}
func (d *Nine) FollowUp() string {
return fmt.Sprintf("The product of the three largest basins is %d", d.vents.productLargestBasins())
}