Python data engineering interview problem. Difficulty: advanced. Pattern: Recursion. About 20 minutes. Part of the Pro drill bank.
A task graph says which jobs depend on which. A cycle means the scheduler can never start. Detect that before launch.
Return whether a task dependency map contains a cycle.
Input: has_cycle({'a': ['b'], 'b': ['a']}) Output: True This input follows the stated rules and produces this output.
Topics: lakebench, python, graphs.
More Python interview questions · All interview problems · Learn data engineering
Interview-style drill: Given a dict mapping each task to its prerequisites, determine whether the dependencies contain a cycle.
Return whether a task dependency map contains a cycle.