Skip to content

Commit

Permalink
add day 7 part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Matrikss committed Dec 7, 2022
1 parent 0349d52 commit aa6888d
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions day7.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,17 @@ func main() {
}

fmt.Println("Part 1: ", part1)

need_to_free := 30000000 - (70000000 - root.size)

min := 30000000
for _, no := range dirs {
if no.size >= need_to_free {
if no.size < min {
min = no.size
}
}
}

fmt.Println("Part 2: ", min)
}

0 comments on commit aa6888d

Please sign in to comment.