Day22
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user