Day 7
This commit is contained in:
24
day07/ex2/main.go
Normal file
24
day07/ex2/main.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"math"
|
||||
"os"
|
||||
"aoc2022/day07/common"
|
||||
)
|
||||
|
||||
func main() {
|
||||
rootFolder := common.Parse(*bufio.NewScanner(os.Stdin))
|
||||
folders := append(rootFolder.GetSubfoldersOverSize(8381165), &rootFolder)
|
||||
min := math.MaxInt32
|
||||
|
||||
for _, folder := range folders {
|
||||
s := folder.GetSize()
|
||||
if s < min {
|
||||
min = s
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Println(min)
|
||||
}
|
||||
Reference in New Issue
Block a user