Product
Pricing
Blog
Forum
NEW
Referral
Description
Solution
Discussion
Submissions
Ask AI
AI Insights
Quick Summary
Design an incremental task scheduler that accepts dependent tasks and executes them in valid topological order.
Support dynamic task insertion while detecting cycles and enforcing lexicographical priority for ready tasks.
Combine a directed dependency graph with in-degree tracking and a min-heap to manage execution state efficiently.
What This Tests
Directed graph modeling with dynamic edge insertion
Incremental topological sorting and in-degree maintenance
Reachability-based cycle detection
Priority queue utilization for ordered extraction
Common Patterns
Graph Traversal
DFS/BFS
Heap / Priority Queue
Hashing
Collapse
Hint 1
Hint 2
Hint 3
What Interviewers May Ask Next
Report
Report seen similar question in interview
Ask AI Assistant
Ask AI Assistant
Ask me anything about this coding question!
python
Auto
Debug
Run
Submit
Stdout
-