Jelajahi Sumber

Probably won't brute force it

Piotr Czajkowski 2 hari lalu
induk
melakukan
7d2b35e949
1 mengubah file dengan 1 tambahan dan 1 penghapusan
  1. 1 1
      19/code.go

+ 1 - 1
19/code.go

@@ -118,8 +118,8 @@ func getMax(patterns [][]string) int {
 
 func part2(patterns [][]string, towels []string) int {
 	var count int
+	maxPatterns := getMax(patterns) * 2
 	for _, towel := range towels {
-		maxPatterns := getMax(patterns)
 		checked := make(map[string]int)
 		count += checkTowel2(towel, 0, patterns, checked, maxPatterns)
 	}