DSA / Graphs Interview Questions 2026
Published July 22, 2026 · Updated July 22, 2026
9 DSA / Graphs interview questions from Google, Amazon, Meta, Microsoft, Flipkart, Uber and more. Real questions from Technical, System Design, and HR rounds.
9 questions
Companies: Google, Amazon, Meta, Microsoft…
All DSA / Graphs Questions
Google
Hard
Technical round
Implement Dijkstra's algorithm using a Fibonacci heap. Compare amortized complexity with a binary heap and explain when the Fibonacci heap is actually slower in practice despite the better theoretical bound.
↑ 71 upvotes · 18 engineers asked this · Staff
Google
Hard
Technical round
JavaPythonGo
Implement a topological sort for a directed acyclic graph. Then extend it to detect cycles and explain how this maps to dependency resolution in build systems like Bazel.
↑ 61 upvotes · 38 engineers asked this · SDE2
Meta
Medium
Technical round
PythonJava
Given a social graph, find all users within K hops of a given user. Implement BFS with a visited set. Then discuss how you would scale this to Meta's 3 billion user graph using partitioning.
↑ 58 upvotes · 37 engineers asked this · SDE1
Meta
Hard
Technical round
JavaPythonDistributed Systems
Given Meta's social graph, find all friend-of-friend recommendations for a user that are not already friends.
Discuss BFS at scale, how to prune the search space, and how to rank recommendations by mutual friend count efficiently.
↑ 54 upvotes · 54 engineers asked this · SDE2
Microsoft
Hard
Technical round
JavaPythonC#
Given a 2D grid of 0s and 1s, count the number of islands. Then extend: find the largest island, and then explain how you would solve this for a streaming grid that changes in real time using a Union-Find structure.
↑ 54 upvotes · 34 engineers asked this · SDE2
Uber
Hard
Technical round
JavaPythonGo
Given a city map as a weighted graph, find the shortest travel time from a driver's current location to all potential passenger pickup points simultaneously. How does Dijkstra's multi-source variant solve this?
↑ 49 upvotes · 30 engineers asked this · SDE1
Amazon
Hard
Technical round
System DesignMicroservicesJava
Given a directed graph representing service dependencies, detect all strongly connected components and explain how this maps to identifying circular dependencies in a microservices architecture.
↑ 39 upvotes · 33 engineers asked this · Staff
Meta
Hard
Technical round
5-9 yearsJavaDistributed Systems
Given a social graph, find the shortest chain of mutual connections between two users (like LinkedIn's "degrees of connection"), and explain how bidirectional BFS improves performance over a single-direction BFS at this scale.
↑ 39 upvotes · 14 engineers asked this · Staff Engineer
Flipkart
Medium
Technical round
JavaPython
Given a directed graph representing category hierarchies in an e-commerce catalog, find the shortest path between two categories. Explain BFS vs Dijkstra for unweighted vs weighted graphs.
↑ 33 upvotes · 18 engineers asked this · SDE1
Practice these questions with AI feedback
Get instant grading on your answers, identify your weak areas, and generate a personalised 14-day study plan — all free.
Build my study plan →
Same topic at specific companies
Related topics
Frequently asked questions
Implement Dijkstra's algorithm using a Fibonacci heap. Compare amortized complexity with a binary heap and explain when the Fibonacci heap is actually slower in practice despite the better theoretical bound.
Implement Dijkstra's algorithm using a Fibonacci heap. Compare amortized complexity with a binary heap and explain when the Fibonacci heap is actually slower in practice despite the better theoretical bound.
Implement a topological sort for a directed acyclic graph. Then extend it to detect cycles and explain how this maps to dependency resolution in build systems like Bazel.
Implement a topological sort for a directed acyclic graph. Then extend it to detect cycles and explain how this maps to dependency resolution in build systems like Bazel.
Given a social graph, find all users within K hops of a given user. Implement BFS with a visited set. Then discuss how you would scale this to Meta's 3 billion user graph using partitioning.
Given a social graph, find all users within K hops of a given user. Implement BFS with a visited set. Then discuss how you would scale this to Meta's 3 billion user graph using partitioning.
Given Meta's social graph, find all friend-of-friend recommendations for a user that are not already friends.
Given Meta's social graph, find all friend-of-friend recommendations for a user that are not already friends.
Discuss BFS at scale, how to prune the search space, and how to rank recommendations by mutual friend count efficiently.
Given a 2D grid of 0s and 1s, count the number of islands. Then extend: find the largest island, and then explain how you would solve this for a streaming grid that changes in real time using a Union-Find structure.
Given a 2D grid of 0s and 1s, count the number of islands. Then extend: find the largest island, and then explain how you would solve this for a streaming grid that changes in real time using a Union-Find structure.