Filter Dog and Cat Comment Subtrees

Given a collection of comments with parent-child relationships and a viewer preference, return the IDs of all comments that must be hidden.

Each comment contains:

  • id: a unique integer ID.
  • `par...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: