Implement select, deselect and display on a rooted tree with visibility rules.
Unlock detailed company stats for this questionUpgrade
Given a rooted tree, implement three operations: select(node), deselect(node) and display(). Selecting a node makes the node itself, its siblings and all its ancestors visible. Multiple selections can coexist, and deselecting a node must not remove visibility that another selection still requires. The interviewer wanted display() to be as efficient as possible.
Community answers
No answers contributed by the community yet.
Related courses

Course

Course
Course
