Hierarchical Region Access Control

Given a tree representing a hierarchy of geographic regions. Each region has a unique name, and a region's children are its direct subregions.

For example:

usa
├── california
│   ├── sf
│   ...

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: