1
0
This commit is contained in:
2020-12-22 06:12:28 +01:00
parent 9490164d09
commit e54fa1b187
3 changed files with 135 additions and 1 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ class Day21(@Lines val input: Input<List<String>>) {
val occurrences = Bags.mutable.empty<String>()
foods.forEach { (ingredients) -> occurrences.addAll(ingredients) }
return allIngredients.filter { !dangerousIngredients.containsValue(it) }
.map { occurrences.count { it == it } }
.map { ingredient -> occurrences.count { it == ingredient } }
.sum()
}