Leetcode 1993. Operations on Tree
Design a data structure for a rooted tree that supports lock(num,user), unlock(num,user) and upgrade(num,user) operations where lock/unlock enforce ownership, and upgrade locks a node only if it is unlocked, has at least one locked descendant (by any user), and has no locked ancestors — then it unlocks all descendants. The core challenge is efficiently checking and updating ancestor/descendant lock status (and mass-unlocking descendants) across many operations.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.