Build a dependency graph for tasks (3-part OA; each part builds on the previous) - adjacency list + topological sort, with regular-expression/glob matching in the final part.
Asked in the Online assessment stage. Implement the combined function below. tasks is a list of unique task names. dependencies[task] lists prerequisite names or Unix glob patterns such as raw_*. Return [adjacency, order], where edges point from each prerequisite to the task that depends on it. Return an empty order if the graph contains a cycle.
def build_task_plan(tasks, dependencies):