Back to problems

Implement ordering and undo executor

Object-Oriented Programming · Netflix · Hard

This interview contains two independent coding tasks. Task 1 You are given n tasks numbered from 0 to n - 1 and a list dependencies of directed pairs. A pair [u, v] means task u must be executed before task v. Return a linear execution sequence that contains every task and satisfies every dependency. If multiple valid sequences exist, return the lexicographically smallest one. If no valid sequence exists because the dependency graph contains a cycle, return []. Example 1:…

Checking your access…