This reminds me the Set Cover Problem:
You have a set U
that stores the N
monsters: U = {1, 2, ..., N}
, a set S
of possible attacks. Each attack is as well a set of the indexes of the monster that the attack kills. In your example, S
is S = { {1}, {2}, {}, {1}, {2} }
. You have to find the smallest set C
in S
whose union is U
.