Study
How Big Tech Disguises Topological Sort, Company by Company
TrueInterview
November 2, 2026 · 13 min read

Course Schedule is still the most-reported version, but many of the other reported titles wrap the same algorithm in a product story. As of 2026-11-02, TrueInterview's bank holds 42 candidate-reported topological sort questions from 17 big-tech companies, including Netflix's ads course-schedule variant, Snowflake's DAG allow/disallow propagation and Amazon's package build order. Of those questions, 32 were reported in phone screens, 16 onsite and 2 in online assessments. The traversal never changes between companies, so the skill to rehearse is turning each company's story into a dependency graph with a cycle verdict, not choosing between Kahn's algorithm and DFS.
Disclosure: TrueInterview is an interview-preparation product and publishes this article. Facts about other products come from their public pages on the dates listed under Sources.
Which version does each company report?
Each company files a different mix of the same algorithm. Course Schedule is the common floor, filed under nine companies, while the domain-framed titles cluster by company: build order, Alien Dictionary, the ads variant and a few titles that belong to one company only. Read the table by row: find your target company, then rehearse every column it touches.
| Company | Questions filed | Course Schedule | Alien Dictionary | Build order | Ads variant | Named cycle variants | Company-specific framing |
|---|---|---|---|---|---|---|---|
| Amazon | 10 | Yes | Yes | Yes | Print Execution Order | Package Dependency Installation & Build Order | |
| Uber | 8 | Yes | Yes | ||||
| ByteDance | 7 | Yes | Yes | Yes | Both | ||
| 6 | Yes | Course Scheduling and Dependency Variants, onsite | |||||
| Snowflake | 5 | Yes | DAG Allow / Disallow Propagation | ||||
| Robinhood | 4 | Load Factor Calculation | |||||
| Meta | 4 | Yes | Yes | ||||
| Oracle | 4 | Titles outside this list | |||||
| Apple | 3 | Yes | Yes | ||||
| Netflix | 3 | Yes | Yes | ||||
| Airbnb, OpenAI | not in top ten | Yes | |||||
| Microsoft | not in top ten | Yes | |||||
| Snapchat | not in top ten | Yes | Course Schedule Cycle Detection | ||||
| DoorDash | not in top ten | Yes |
Amazon and ByteDance each span at least four framings in this table, so a candidate for either should expect the story to change from one interviewer to the next. An Uber, Meta or Apple candidate starts from a narrower pair, Course Schedule and Alien Dictionary; the rest of those companies' filed questions are titles not listed here. Our advice is to cover the build-order and cycle titles anyway, because they reuse the same routine at almost no extra cost.
Our take: no company in the table owns a single version, so prepare a company's row, not a company's favourite question.
Where do these questions come up: phone screen or onsite?
Mostly in phone screens, which means you need a working implementation before your first technical call, not before the onsite. All 32 phone-screen questions and all 16 onsite questions carry the topological-sort tag, with graphs as the next tag in both rounds. Of the 42 questions, 40 were last reported within the 12 months before 2026-11-02, so the material is current.

| Reported title | Example company | Round | Last reported | Write-up links | Practise |
|---|---|---|---|---|---|
| Course Schedule | Apple | Phone screen | 2026-10 | 33 | Course Schedule |
| Topological Sort / Course Schedule for Ads | Netflix | Phone screen | 2026-10 | 13 | Ads variant |
| Alien Dictionary | Uber | Phone screen | 2026-09 | 10 | Alien Dictionary |
| Course Schedule Cycle Detection | Snapchat | Phone screen | 2026-10 | 10 | Cycle detection |
| Print Execution Order in a DAG and Detect Cycles | ByteDance | Phone screen | 2026-10 | 10 | DAG execution order |
| Dependency Resolution / Build Order | Airbnb | Phone screen | 2026-09 | 7 | Build order |
| DAG Allow / Disallow Propagation | Snowflake | Phone screen | 2026-09 | 6 | Allow / disallow propagation |
| Load Factor Calculation | Robinhood | Phone screen | 2026-04 | 5 | Load factor |
| Package Dependency Installation & Build Order | Amazon | Phone screen | 2026-08 | not counted | Package build order |
| Course Scheduling and Dependency Variants | Onsite | 2026-10 | not counted | Google variants |
Only Google's entry in this list is an onsite. This article works from titles and tags only, and this title suggests variants on one base problem rather than one fixed prompt, so for a Google onsite practise extending a finished solution rather than starting a fresh one.
How do the course-schedule framings differ by company?
Course Schedule is the undisguised version: courses are nodes and a prerequisite is an edge. Its write-up links lean junior, 13 from senior-or-above candidates against 20 from junior-or-below candidates. Netflix, Amazon and ByteDance file a version whose title moves the same problem onto ads, and its links run the other way, 10 senior-or-above against 3 junior-or-below.
Working from the title alone, the useful preparation for the ads variant is the translation step. Before you code, say aloud what a node is and what an edge means in the interviewer's nouns. The interviewing.io author calls graph building "by far the most critical step in the algorithm and one where candidates struggle the most". Stating the node and the edge early is the safest opening for any domain-framed version.
What do build-order questions look like at Amazon, Airbnb, OpenAI and ByteDance?
They are the most literal disguise: packages or modules are nodes, and an edge means one must be built before the other. Dependency Resolution / Build Order is filed under Amazon, Airbnb, OpenAI and ByteDance, and Amazon candidates also report a separate Package Dependency Installation & Build Order question. Wikipedia lists "determining the order of compilation tasks to perform in makefiles" as a standard use of topological sorting.
Its links split 4 senior-or-above against 3 junior-or-below, too few to call a trend but enough to show that experienced hires get it. Two details separate a clean answer from a buggy one. First, packages with no dependencies still need installing; the interviewing.io author warns candidates to make sure vertices without relationships are incorporated into the graph. Second, if the interviewer wants a reproducible order, a heap in place of the queue gives one; Wikipedia notes that a lexicographic tie-breaking variant of Kahn's algorithm is a key component of the Coffman–Graham algorithm.
Why does Alien Dictionary count as the same problem at Uber, Meta, Microsoft, Apple and ByteDance?
Because the dependency graph is hidden in a sorted word list: each adjacent pair of words contributes at most one edge, from the first letter where the two words differ. Alien Dictionary is filed under Uber, Meta, Microsoft, Apple and ByteDance. The interviewing.io author describes it as "determining whether a given order of words is valid according to an imaginary dictionary" and, if so, returning a possible letter order.
cp-algorithms describes the general form as pairwise less-than constraints that you check for contradiction before outputting the variables in ascending order. Alien Dictionary is that form with the constraints left for you to extract, and three inputs break careless solutions: a word followed by its own prefix, which makes the list invalid; letters that appear but gain no edge, which still belong in the output; and contradictory pairs, which form a cycle. Its links lean senior, 6 against 4, which fits our view that extraction, not traversal, is where this one is decided.
What are the single-company framings at Snowflake and Robinhood?
They are titles that never mention ordering at all. Snowflake candidates report DAG Allow / Disallow Propagation, and Robinhood candidates report Load Factor Calculation. A third, Role Privilege System, is filed under two companies and linked from 3 write-ups, split 2 senior-or-above against 1 junior-or-below.
This article describes these questions by title and tag only, and every one of the 42 questions carries the topological-sort tag. Treat each title as a cue rather than a specification. When a prompt talks about propagation, inheritance or a value computed across dependent parts, ask whether values must flow from each node to its dependants in a fixed order; if they must, processing nodes in topological order and accumulating along edges is the backbone. The Snowflake title splits its links evenly, 3 and 3, so no level should skip it.
Which companies make the cycle verdict part of the question?
ByteDance, Snapchat and Amazon do, by name. Print Execution Order in a DAG and Detect Cycles is linked from ByteDance and Amazon write-ups, Course Schedule Cycle Detection is linked from ByteDance and Snapchat write-ups, and Minimum Time to Finish All Dependent Tasks with Durations (Detect Cycles) is filed under two companies. A cycle check is part of the expected answer, not a follow-up you can wait for.
Both named cycle titles lean junior, 3 senior-or-above against 7 junior-or-below each, so for experienced hires they are the screen to pass quickly. With Kahn's algorithm the verdict costs nothing: Wikipedia's description says that if edges remain at the end, "the graph must have at least one cycle and therefore a topological sort is impossible". A plain finish-order DFS gives you no such signal; cp-algorithms presents an implementation that "assumes that the graph is acyclic". The durations title adds one step on top: once nodes come out in topological order, each task's finish time is its duration plus the latest finish among its prerequisites.
Should you write Kahn's algorithm or DFS?
Write Kahn's algorithm for these framings, and do not spend interview time defending the choice. Wikipedia states that linear-time algorithms exist for constructing a topological ordering and that the DFS-based one also runs in linear time. Kahn's wins on the follow-ups: it gives the cycle verdict by counting processed nodes, and it produces level-by-level output for parallel steps.
The interviewing.io author leans the same way: "My preference tends to be BFS as some objects tend to be on the same level". The same author says DFS works if you only need one solution and advises asking whether the interviewer wants one ordering or all of them. GeeksforGeeks describes Kahn's algorithm as repeatedly selecting vertices with in-degree zero, adding them to the result and reducing their neighbours' in-degree. Written once, it covers every framing above:
from collections import deque
def topo_order(nodes, edges):
# edges are (before, after) pairs; nodes must include every endpoint.
# Returns (order, None), or (None, nodes on or after a cycle).
adj = {n: [] for n in nodes}
indeg = {n: 0 for n in nodes}
for a, b in edges:
adj[a].append(b)
indeg[b] += 1
ready = deque(n for n in nodes if indeg[n] == 0)
out = []
while ready:
n = ready.popleft()
out.append(n)
for m in adj[n]:
indeg[m] -= 1
if indeg[m] == 0:
ready.append(m)
if len(out) < len(nodes):
return None, [n for n in nodes if indeg[n] > 0]
return out, None
If DFS is what you write without bugs, keep it and add a three-state mark (unvisited, in progress, done); reaching an in-progress node is the cycle.
What changes at senior and staff level?
Overall, links to these questions lean junior: 59 from candidates who reported a senior, staff-plus or manager level and 80 from junior, new-grad or intern candidates. The split reverses on the domain-framed titles covered above, the ads variant and Alien Dictionary, while the plain cycle-detection titles lean junior. The level difference is in the wrapping, not the algorithm.
Our take: at senior level, expect the problem to arrive inside a product story and expect the evaluation to rest on how quickly and precisely you model the graph and state the contract: what a node is, what an edge means, what comes back on a cycle, and how ties break. Small counts such as the role-privilege split do not make a trend, so do not over-read any single row.
Down-leveling note (our view): the senior-leaning titles in these reports are the ones that make you build the graph from a story, so a slow or muddled modelling step is where an experienced hire risks reading as mid-level in this round. The level itself is mostly set in system design and behavioral rounds; here, the aim is to not give away signal.
The pattern is not limited to software engineers. Machine learning engineers account for 11 of the links and software engineers for 117, and every link from either group points to a topological-sort-tagged question, so an ML candidate should not skip it.
Worked example: one implementation across ByteDance's framings
ByteDance has 7 topological sort questions filed in the bank, and its candidates' reports touch five framings: Alien Dictionary, Dependency Resolution / Build Order, the ads variant, Course Schedule Cycle Detection and Print Execution Order in a DAG and Detect Cycles. That makes it the clearest case for one implementation rehearsed against several stories.
Translate each title into a node and an edge before touching code. For Alien Dictionary, letters are nodes and the first differing letter of two adjacent words gives an edge. For build order, packages are nodes and a dependency points from the package that must come first. For the two cycle titles, the nodes are given and the deliverable is either the order or the cycle verdict. For the ads variant, ask the interviewer to define a node, because the title alone does not. All of them then run through the same topo_order function, and the only change is how you build nodes and edges. A small trace shows the Alien Dictionary step: the sorted words ba, bc, ac give the edge a to c from the first pair and b to a from the second, so topo_order starts from b, the only letter with no incoming edge, and returns b, a, c. Add the word ab after ac and you also get c to b, which closes the loop a to c to b to a, so the function returns the cycle verdict instead. Open the call by asking whether any valid order is acceptable, what to return on a cycle, and whether some nodes have no dependencies.
How we counted
We counted questions in TrueInterview's bank that carry the topological-sort tag and are filed under a big-tech company, as of 2026-11-02. Write-up links count candidate interview write-ups that link to a question; a question filed under a company says what candidates reported there, not how often that company asks it. Levels and roles are what candidates reported about themselves, and the questions are reconstructed for practice, not any company's official list.
FAQ
Is topological sort usually a Hard problem?
The interviewing.io author writes that "most of the questions related to the topic are tagged Hard". Our counts measure rounds rather than difficulty, and they place the pattern mainly in phone screens, as the round section above shows. In practice, that means you should prepare it as a fast, bug-free routine you can finish with time left for a follow-up, rather than as a stretch problem you hope to reason through on the day. The algorithm is short; the difficulty sits in building the graph from the story.
How do I spot that a problem needs topological sort?
The interviewing.io author suggests one test: "Is the problem related to dependencies between objects?". Wikipedia calls scheduling a sequence of jobs or tasks based on their dependencies the canonical application. If the prompt contains words such as prerequisite, depends on, must run before, inherits from or propagates to, sketch the graph first. If the relation can loop back on itself, the question almost certainly wants a cycle verdict as well.
Do I need to return every valid order?
Usually not, but ask. GeeksforGeeks notes that a graph may have several topological orderings, and cp-algorithms says a topological order can be non-unique. If the interviewer wants one order, Kahn's algorithm with any ready-set structure is enough. If they want all orders, switch to backtracking over the nodes with zero remaining in-degree and warn that the output can grow very fast. If they want one specific order, agree on a tie-break and use a heap.
How do I detect a cycle if I use DFS?
Track three states per node: unvisited, in progress and finished. Reaching a node that is still in progress means you have found a back edge, which is a cycle. GeeksforGeeks notes that topological sort is also used to detect cycles in directed graphs, for example deadlock detection in operating systems. To report the cycle itself, keep a parent map and walk back from the repeated node to the point where you entered it.
Your practice plan
- In the first week, write the
topo_orderfunction from memory on Course Schedule and Course Schedule Cycle Detection until it returns an order or a cycle verdict without a bug, and time each attempt. - Find your target company's row in the table above and list every framing it touches; for each title, write one sentence defining the nodes and edges before you look at any solution.
- If your target is Amazon, Airbnb, OpenAI or ByteDance, practise Dependency Resolution / Build Order and Package Dependency Installation & Build Order, including packages with no dependencies.
- If your target is Uber, Meta, Microsoft, Apple or ByteDance, practise Alien Dictionary and add the prefix case and the isolated-letter case to your tests.
- In the second week, cover the company-specific stories: the ads course-schedule variant for Netflix, Amazon or ByteDance, DAG Allow / Disallow Propagation for Snowflake, Load Factor Calculation for Robinhood and Course Scheduling and Dependency Variants for a Google onsite.
- In the third week, rehearse the follow-ups: return the cycle itself on Print Execution Order in a DAG and Detect Cycles, add durations on Minimum Time to Finish All Dependent Tasks with Durations, and model inheritance on Role Privilege System.
- Before each mock or real screen, say your opening questions aloud: is any valid order acceptable, what should come back on a cycle, and can a node have no dependencies.
Sources
- TrueInterview question bank — topological sort at big-tech companies — counted 2026-11-02
- Topological Sort Interview Questions & Tips for Senior Engineers — checked 2026-11-02
- Topological sorting - Wikipedia — checked 2026-11-02
- Topological Sorting - Algorithms for Competitive Programming — checked 2026-11-02
- Topological Sorting - GeeksforGeeks — checked 2026-11-02
Last reviewed: 2026-11-02.