Back to problems

Propagate Task Filtering Through Ancestors

Algorithm · Rippling · Hard

A task-management system keeps every task alongside a link to the task that owns it, so the records form a tree-shaped hierarchy. Deleting a task must not strand the work beneath it: taking out a task also takes out everything that reports up to it, no matter how many levels deep that goes. The stored records are not guaranteed to be delivered in a useful order — an entry for a child can appear before the entry for its owner. You are given tasks, a list of [id, parentId]…

Checking your access…