Back to problems

AI-Assisted Order Validator

Low-Level Design · ByteDance · Medium

Approach: Dependency DAG with Bidirectional Adjacency Sets Treat each validation rule as a node in a directed graph. An edge prerequisite -> dependent means “run prerequisite before dependent.” The validator must be able to add rules, remove rules, reject cyclic dependencies, and execute active rules in a valid topological order. The key implementation choice is to keep two edge views. outgoing[u] stores all rules that depend directly on u, while incoming[v] stores all…

Checking your access…