Save 25%Black Friday: 25% off all plans — use code BLACKFRIDAY2026 at checkout. Ends Friday, Dec 4.Claim the deal

Question Description

You are given a hierarchy of monsters represented as a n-ary tree. Each monster has a unique name, a list of monsters it can defeat, and a hostile status. A monster marked with an asterisk ("*") is considered hostile.

Given a list of monsters and the root monster, return a list of non-hostile monsters that can defeat all hostile monsters in the hierarchy.

Stdout
-