Return a Topological Order or Detect a Cycle
Company: Runloop
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
Overview: Return a deterministic topological ordering of a directed graph or an empty result when a cycle exists. Ignore duplicate edges and choose the smallest zero-indegree vertex at every step so valid graphs always produce the same order.