Study
The Most-Reported Graph Questions at Big Tech in 2026
TrueInterview
October 18, 2026 · 15 min read

As of 2026-10-18, TrueInterview's bank holds 252 candidate-reported graph questions from 25 big-tech companies, and 232 of them were last reported within the past 12 months. The most-linked ones mix product scenarios with a few classics: Infection Spread Simulation leads with 36 candidate write-ups, ahead of Course Schedule with 21 and Web Crawler with 17. Phone screens account for more reports than any other round, so drill multi-source BFS, topological sort with cycle detection and union-find before you spend an hour on Dijkstra or minimum spanning trees.
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 graph questions do candidates report most?
The most-linked graph questions in the bank come down to three patterns: breadth-first search on a grid or state space, topological sort on dependencies, and union-find on connectivity that changes over time. One tree question sits inside the set because it carries a graph tag. The table is sorted by candidate write-up links and shows the senior-or-above links from self-reported levels.

| Question | Companies in the write-ups | Write-up links | Senior-or-above links | Pattern (our read) | Practise |
|---|---|---|---|---|---|
| Infection Spread Simulation | OpenAI, Anthropic | 36 | 27 | Multi-source BFS | Infection Spread Simulation |
| Course Schedule | Amazon, Google, Snowflake, Uber, Netflix, Meta | 21 | 9 | Topological sort | Course Schedule |
| Web Crawler | Anthropic | 17 | 11 | BFS with a visited set | Web Crawler |
| Lowest Common Ancestor of a Binary Tree | Meta, Microsoft, Amazon | 12 | 6 | Tree recursion | LCA |
| Find Optimal Commute | Databricks | 12 | 7 | Company-specific routing | Find Optimal Commute |
| Alien Dictionary | Uber, Meta, Microsoft, ByteDance | 8 | 4 | Topological sort | Alien Dictionary |
| The Earliest Moment When Everyone Become Friends | Google, Uber | 8 | 5 | Union-find | Earliest Moment |
| Number of Islands II | Uber, Google | 8 | Not split | Union-find | Number of Islands II |
Write-up links count candidate write-ups that point to a question; they are not a measure of how often a company asks it. Our take: read the table as three drills rather than a list of problems. The spread simulation and the crawler are BFS, Course Schedule and Alien Dictionary are topological sort, and the two connectivity questions are union-find. If you own those templates, most of the list turns into follow-up practice. Outside the table, Binary Tree Right Side View is also linked from 8 write-ups and Word Search II from 6.
Breadth across companies tells a slightly different story. Course Schedule is filed under 9 big-tech companies, the widest spread among the questions in this article. Number of Islands (Plain and Streaming) is filed under 7 companies, yet it is linked from 0 write-ups. Serialize and Deserialize Binary Tree and Lowest Common Ancestor are filed under 6 companies each, and Alien Dictionary under 5.
Our take: the classic LeetCode list is the floor, not the target. Some classics are both widely filed and heavily linked, as Course Schedule is, while Number of Islands (Plain and Streaming) is filed widely but not written up. The scenario questions, the spread simulation, the crawler and the commute question, sit beside the classics at the top. Prepare the template on the classic, then spend your time on the reported scenario.
Where do graph questions show up: OA, phone screen or onsite?
Phone screens carry the most graph reports: 171 questions were reported there, against 105 onsite and 21 in online assessments. A question can be reported in more than one round, so these counts overlap. Phone screens come before the onsite, so practise graphs early in your preparation rather than at the end.
The secondary tags shift by round. Phone-screen graph questions most often add matrix (25), hashing (16) and backtracking (16) tags. Onsite graph questions add matrix (20) and trees (18). OA graph questions are few, with hashing and matrix at 3 each. Matrix is the top overlay in both rounds, and trees are a top overlay onsite, though Uber's LCA report came from a phone screen. Expect a grid in either round and do not assume trees wait for the onsite.
Dated examples show what the scenarios look like:
| Company | Question | Round | Last reported |
|---|---|---|---|
| OpenAI | Infection Spread Simulation | Phone screen | 2026-09 |
| Apple | Course Schedule | Phone screen | 2026-10 |
| ByteDance | Print Execution Order in a DAG and Detect Cycles | Phone screen | 2026-10 |
| Uber | Lowest Common Ancestor of a Binary Tree | Phone screen | 2026-09 |
| Databricks | Find Optimal Commute | Phone screen | 2026-08 |
| Anthropic | Web Crawler | Phone screen | 2026-05 |
| Amazon | Delivery-Center Grid — Minimum Inconvenience | OA | 2026-09 |
| Coinbase | Mining Block | Onsite | 2026-05 |
If your recruiter has scheduled a phone screen, the first three patterns should be fluent before that call. Use the onsite weeks for harder follow-ups and a second pass on tree questions.
Why should BFS be the first pattern you practise?
BFS comes first because the most-linked graph question in the bank is a spread simulation, and TrueInterview's site lists a Medium Apple question from October 2026, Plant Infection Spread: Days Until Stable. In our read, both reward the same skill: multi-source BFS that advances one level per round and counts rounds until nothing changes.
The mechanics are standard. cp-algorithms describes BFS as "a fire spreading on the graph", one ring at a time, and the path it finds to each node uses the fewest edges in an unweighted graph. cp-algorithms gives its running time as O(n + m) for n vertices and m edges. cp-algorithms also notes that when each state of a puzzle or game is a vertex, BFS finds the solution with the fewest moves. Tech Interview Handbook's graph guide says interview graphs are commonly given as 2D matrices. In our bank, matrix is the most common secondary tag in this set at 38 questions.
What to practise, in order:
- Multi-source BFS that returns the rounds until the state is stable, as in the Apple question that TrueInterview's site lists. Our recommended follow-up is a check for cells that are never reached. Start with Infection Spread Simulation.
- A streaming variant. TrueInterview's site lists a Medium Amazon Number of Islands question with max-area and streaming-rows follow-ups in October 2026.
- A state-space BFS where the vertices are not cells, such as Minimum Time to Infect a Network or Anthropic's Web Crawler.
Our take: the follow-up is where spread questions are won. Have an answer ready for unreachable cells, for a grid that never stabilizes and for a source that appears mid-simulation, because the base BFS is the part every prepared candidate writes.
How do interviewers test topological sort and cycle detection?
Topological sort is the second pattern to practise: Course Schedule is linked from 21 write-ups, and TrueInterview's site lists a Hard Google question from October 2026, Course Scheduling and Dependency Variants. Expect the question to be told as tasks, builds or versions. In our view, the cycle check is where most solutions lose points.
Recognition is the first skill. PracHub's topological sort guide lists the signal as an ordering, sequence or schedule of items with prerequisites, and treats whether all courses can be finished as cycle detection on a dependency graph. cp-algorithms notes that a topological order exists only when the directed graph has no cycle, and that it is not necessarily unique.
Worked example: Course Schedule, from base to follow-up
Course Schedule is filed under 9 companies and linked from 21 write-ups, 9 from senior-or-above candidates and 12 from junior-or-below candidates. Apple reported it in a phone screen in 2026-10. The base solution is Kahn's algorithm:
- Build an edge from each prerequisite to the course that needs it. PracHub's guide puts it bluntly: "Edge direction is where most solutions die".
- In our solution, push every node that has no incoming edges, then pop, append and decrement each neighbour's in-degree. PracHub's guide notes that if fewer than V nodes come out, the leftovers sit on or downstream of a cycle, so return an empty result.
PracHub's guide gives both Kahn's and DFS ordering as O(V + E). Three follow-ups extend the same code. ByteDance reported Print Execution Order in a DAG and Detect Cycles in a phone screen; its title suggests the same Kahn's template plus cycle reporting. PracHub's guide adds that if dependencies arrive lazily through an API, DFS post-order fits better, because Kahn's needs every edge up front. If the interviewer asks for the lexicographically smallest order, swap the queue for a min-heap; PracHub notes that interviewers usually accept any valid order unless they specify a tie-break.
Our take: Kahn's is the better default for interviews. The length check gives you cycle detection for free, and the in-degree table is easy to narrate while you code. Keep DFS post-order for the lazy-graph follow-up.
When is union-find the right tool?
Union-find belongs in your first tier because the bank's dynamic-connectivity questions come from Google and Uber: The Earliest Moment When Everyone Become Friends and Number of Islands II are each linked from 8 write-ups. Our take: it takes an evening to learn, so it is the cheapest pattern on this list to add.
The structure is short. cp-algorithms explains that Disjoint Set Union is called union-find after its two operations, and that two items are in the same set exactly when their find results are equal. cp-algorithms warns that without optimizations the trees can degenerate into chains, so each find can cost O(n). In the cp-algorithms analysis, path compression combined with union by size or rank gives nearly constant time, and the two union rules are interchangeable.
Our take: when cells or edges arrive over time and the question asks about connectivity after each arrival, use union-find. Rerunning BFS from scratch after every addition is the slower answer, and we would expect an interviewer to push you past it on Number of Islands II. Write DSU once from memory, then solve both reported questions with it.
Are Dijkstra, Bellman-Ford and MST worth your time?
Learn Dijkstra well enough to recognize it, then stop. In our table, no question is titled as a Dijkstra or minimum-spanning-tree problem, though Find Optimal Commute is a routing question. Tech Interview Handbook's graph guide lists Dijkstra and topological sort as uncommon. Our bank qualifies the second half of that rating: topological sort is tagged on only 19 of 252 questions, yet Course Schedule (21 links) and Alien Dictionary (8) are among the most-linked graph questions, so the pattern is concentrated rather than rare.
Tech Interview Handbook's graph page goes further and places Bellman-Ford, Floyd-Warshall, Prim's and Kruskal's in its "Almost never" tier. One Medium author wrote that Dijkstra's core assumption only holds when all weights are positive. cp-algorithms notes that for graphs whose edges weigh 0 or 1, a small modification of BFS finds shortest paths.
Our take: learn to recognize those two weighted cases, then put the remaining hours back into the three core patterns.
Do Google, Uber, Amazon and Meta report different graph questions?
The tag mixes look similar; the differences show up in specific questions, such as Course Schedule across Amazon, Google, Meta and Uber, and the union-find pair at Google and Uber. Google has the most graph questions in the bank with 46, followed by Uber (39), Amazon (35), ByteDance (32), Meta (29), Microsoft (23), Snowflake (22), Apple (18), LinkedIn (10) and OpenAI (9). These counts reflect what candidates reported, not how often each company asks graphs.
| Company | Graph questions | Trees | Matrix | Backtracking | Hashing |
|---|---|---|---|---|---|
| 46 | 7 | 5 | 3 | 2 | |
| Uber | 39 | 6 | 6 | 3 | 3 |
| Amazon | 35 | 6 | 7 | 3 | 3 |
| ByteDance | 32 | 5 | 3 | 6 | 0 |
| Meta | 29 | 7 | 6 | 4 | 2 |
| Microsoft | 23 | 6 | 1 | 3 | 3 |
ByteDance has the most backtracking tags in the table, 6 of 32, and Microsoft has only 1 matrix tag among 23 questions, with trees on 6. Beyond the big six, the questions turn company-specific: Snowflake's Closest Cake and Global Assignment and Robinhood's Employee Referral Program were both phone-screen reports.
Decision rule (our view): for an OpenAI or Anthropic loop, practise the spread simulation and the BFS crawler first. For Amazon, Google, Meta, Uber, Apple or Snowflake, practise Course Schedule-style topological sort first, then islands and union-find, then tree questions such as LCA. Either way, open the reported questions for your company and order them by round.
Where do tree questions fit in a graph set?
Trees are the second most common overlay on graph questions, and they are a top overlay onsite. Lowest Common Ancestor is filed under 6 companies and splits evenly by level, 6 senior-or-above and 6 junior-or-below links. Treat these as tree problems that happen to carry a graph tag, and do not assume they wait for the onsite.
Binary Tree Vertical Order Traversal is filed under 4 companies and linked from 5 write-ups. Serialize and Deserialize Binary Tree is filed widely but linked from only 2 write-ups. One trap links the two families: Tech Interview Handbook's guide says that a tree-like diagram may be a graph with cycles, where a naive recursive solution fails and you need a visited set. Ask whether the input can contain a cycle before you write the recursion.
What changes at senior and staff level?
Graphs do not fade at senior level. Candidate write-ups link these questions 241 times from senior, staff-plus or manager candidates and 249 times from junior, new-grad or intern candidates. A few questions lean senior, and the counts are small, so read them as a lean rather than a pattern.
The skews are clear in the counts. Infection Spread Simulation draws 27 senior-or-above links against 9 junior-or-below, and Web Crawler 11 against 6. Dependency Version Check, Minimum Time to Infect a Network and Tree-Encoded Subtree Deletion and Stable Compaction appear only in senior-or-above write-ups. Staff-plus or manager write-ups include Robot Navigation in an Unknown Grid, Shortest Path in a Grid with at Most K Cells per Move and Nearest Supply Point in a Map. By topic, senior-or-above candidates link fewer matrix questions (31 against 42) and more backtracking (25 against 20).
Our take: at senior level the base algorithm is assumed. The signal comes from how you handle an unknown or changing graph, how you state complexity before you code, and whether you raise the edge cases (disconnected parts, cycles, unreachable states) before the interviewer does.
Down-leveling note (our view): since graph links are near-even across levels, a graph round is unlikely to separate senior from mid-level on its own; the level signal tends to come from system design depth, the project deep dive and behavioral scope. A slow or hint-heavy coding round can still weaken your case for the level you applied for.
Do ML and AI candidates see different graph questions?
Directionally, yes: topological sort makes up 22% of graph links from machine-learning, AI, research and data-science candidates, against 15% for software engineers, while matrix makes up 7% against 16%. The ML-side sample is 41 links against 448 for software engineers, so treat this as a lean, not a rule.
Dependency Version Check is linked by 4 ML or AI candidates and 1 software engineer, and Course Schedule Cycle Detection by 3 and 2. Infection Spread Simulation still draws 9 links from ML and AI candidates. If you are interviewing for an ML engineer or research role, give dependency ordering extra time and keep the spread simulation on your list.
Which mistakes fail graph solutions?
Our view is that many failed graph solutions break on bookkeeping rather than on the algorithm. The sources below name visited tracking, bounds, queue choice and corner cases, and edge direction comes from PracHub's guide. Run this checklist against every solution before you say you are done:
- Visited tracking. Tech Interview Handbook's guide says that failing to track visited nodes can put your code in an infinite loop.
- Bounds on grids. Tech Interview Handbook's guide says to check that each position is inside the matrix and not yet visited.
- Queue type. Tech Interview Handbook's guide says to use a deque, because dequeuing from a Python list costs O(n).
- Edge direction. In dependency problems, reverse edges produce a valid-looking but wrong order (see the worked example above).
- Corner cases. Tech Interview Handbook's guide lists an empty graph, one or two nodes, disconnected graphs and graphs with cycles.
- Unoptimized DSU. Union-find without path compression degrades on long chains (see the union-find section).
How we counted
Counts come from TrueInterview's question bank as of 2026-10-18 and cover 252 graph-tagged practice questions reported at 25 big-tech companies. They are candidate-reported questions reconstructed for practice, not any company's official question list. A question can be filed under several companies and reported in several rounds, so tallies overlap. Level and role splits count write-up links by the level and role each candidate reported, and a link count measures what candidates wrote up, not how often a company asks a question.
FAQ
What are the most common graph interview questions in 2026?
By candidate write-up links, the leaders are Infection Spread Simulation, Course Schedule and Web Crawler, followed by Lowest Common Ancestor and Find Optimal Commute (see the ranked table). Each of the five has a phone-screen report dated 2026, which makes them current rather than evergreen picks. If you only have a weekend, practise the first two, because they cover multi-source BFS and topological sort.
Which graph pattern should I practise first?
Start with BFS, then topological sort with cycle detection, then union-find. BFS covers the most-linked question and the grid-shaped phone-screen problems. Topological sort covers Course Schedule, the most widely filed question in this article. Union-find is short to learn and covers the dynamic-connectivity questions from Google and Uber. Leave weighted shortest paths and spanning trees until those three are fluent.
Are classic LeetCode graph problems still asked?
Yes, and some are written up heavily: Course Schedule is the second most-linked question in our table. Others are filed widely but rarely written up, such as Number of Islands (Plain and Streaming), filed under 7 companies with no linked write-ups. Use the classic to learn the template, then practise the reported scenario that wraps it.
How do I recognize a graph problem when it does not say so?
Look for three shapes. A grid where cells change or spread is BFS. A set of tasks, courses, builds or versions with prerequisites is topological sort. Items that join groups over time, with a question about when everything is connected, is union-find. Puzzles that ask for the fewest moves are BFS over states.
What are easy graph questions to start with, and which are hard?
Start with the single-source and multi-source grid BFS questions and the base Course Schedule. The hard end is the variant work, such as the Hard Google dependency-variants question that TrueInterview's site lists. In our view, the staff-level grid navigation questions with unknown or constrained moves belong at that end too. Climb from base to variant on the same pattern rather than switching patterns.
Do senior candidates get harder graph questions?
The level data shows a different mix, not a difficulty score. Senior-or-above links lean toward the simulation, crawler and dependency-version questions, and some questions appear only in senior write-ups, while classics such as Course Schedule and LCA still draw senior links. In our view, prepare for follow-ups that test whether you raise edge cases and complexity before you are asked.
Your practice plan
A three-week plan for someone working full time, about an hour a day:
- Week one, first. Write multi-source BFS that returns rounds until stable, then solve Infection Spread Simulation inside one interview timebox, including the unreachable-cell follow-up.
- Week one, then. Practise grid and state-space BFS on Number of Islands (Plain and Streaming), Delivery-Center Grid and Web Crawler.
- Week two, first. Write Kahn's algorithm with the length check from memory, then solve Course Schedule, Course Schedule Cycle Detection and Alien Dictionary, checking edge direction on each.
- Week two, then. Implement DSU with path compression and union by size, then solve Number of Islands II and The Earliest Moment When Everyone Become Friends.
- Week three, first. Do the tree questions: Lowest Common Ancestor of a Binary Tree and Serialize and Deserialize Binary Tree.
- Week three, then. If you are interviewing at senior level or for an ML role, add Dependency Version Check and Minimum Time to Infect a Network.
- Week three, last. Open the reported graph questions for your target company in the question bank, note the round for each, and order your final review with phone-screen questions first.
Sources
- TrueInterview question bank — graph at big-tech companies — counted 2026-10-18
- Real FAANG Interview Questions by Company · TrueInterview — checked 2026-10-18
- Breadth First Search - Algorithms for Competitive Programming — checked 2026-10-18
- Graph cheatsheet for coding interviews | Tech Interview Handbook — checked 2026-10-18
- Topological Sort Interview Guide: Kahn's Algorithm, DFS & Cycle Detection | PracHub Knowledge Hub — checked 2026-10-18
- Topological Sorting - Algorithms for Competitive Programming — checked 2026-10-18
- Disjoint Set Union - Algorithms for Competitive Programming — checked 2026-10-18
- Medium — checked 2026-10-18
Last reviewed: 2026-10-18.