You get the (parent, child) edges of a directed graph. Decide whether they describe a valid forest — one or more separate rooted trees. A Waymo phone-screen question where your code has to run against your own tests.
You get the (parent, child) edges of a directed graph. Decide whether they describe a valid forest — one or more separate rooted trees. A Waymo phone-screen question where your code has to run against your own tests.
The discussion opens with the full question.