All 93 questions
How do BFS and DFS differ, and when would you choose BFS?
Asked in 5 of 374 interviews · last asked Oct 7 · Concept · Junior
Show answer
BFS explores nodes level by level using a queue. DFS follows one path as far as possible before backtracking, using a stack or recursion. Choose BFS to find a shortest path in an unweighted graph, find the nearest matching node, or process nodes level by level.
- BFS finds paths with the fewest edges; DFS does not guarantee this.
- Both take O(V + E) time with adjacency lists, where V counts vertices and E counts edges.
- Track visited nodes in graphs to avoid revisiting nodes and looping through cycles.
- BFS can hold many nodes on wide levels; recursive DFS risks stack overflow on deep paths.
What the interviewer checks: The interviewer checks whether you understand traversal order, data structures, and why BFS suits unweighted shortest paths.
Other ways it was asked
- “What is the difference between BFS and DFS?”
- “How are DFS and BFS different?”
- “What is the difference between depth-first search (DFS) and breadth-first search (BFS)?”
What is Dijkstra's algorithm, and when is it used?
Asked in 3 of 374 interviews · last asked Oct 9 · Concept · Junior
Other ways it was asked
- “Can you explain the Dijkstra algorithm?”
- “What is the Dijkstra algorithm?”
Explain the A* algorithm for calculating the shortest path.
Asked in 2 of 374 interviews · last asked Oct 9 · Concept · Junior
Other ways it was asked
- “Can you explain the A* algorithm?”
Which data structure is commonly used for indexing in a database management system?
Asked in 2 of 374 interviews · last asked Aug 27 · Concept · Junior
Other ways it was asked
- “What data structures are commonly used to implement database indexes?”
What is a binary search tree?
Asked in 2 of 374 interviews · last asked Sep 30 · Concept · Junior
What algorithmic approach would you use to find the longest consecutive sequence along a root-to-leaf path in a tree?
Asked once · last asked Sep 15 · Write code · Mid-level
Other ways it was asked
- “What is the time complexity of an algorithm for finding the longest consecutive sequence along a root-to-leaf path in a tree?”
- “How would you solve the same problem when given a tree, finding the longest consecutive sequence along any path from the root to a leaf?”
- “How would you solve the problem of finding the longest consecutive sequence along a root-to-leaf path in a tree?”
How would you implement hierarchical folder traversal in Power Apps or Power Automate?
Asked once · last asked Jun 9 · Tooling · Mid-level
Other ways it was asked
- “How would you implement hierarchical folder traversal in Power Automate?”
Given an array of integers, how would you convert it into a min heap?
Asked once · last asked Jul 27 · Concept · Junior
Other ways it was asked
- “Please explain the process of converting an array of integers into a min heap.”
In the binary-tree maximum path sum problem, what counts as a path, and how should the solution handle a tree whose node values are all negative?
Asked once · last asked Sep 10 · Concept · Mid-level
Other ways it was asked
- “How should a binary-tree maximum path sum solution handle an all-negative tree or an empty tree?”
- “How should a binary-tree maximum path sum algorithm handle a negative contribution from a child node?”
What is the difference between a graph and a tree?
Asked once · last asked Jan 27 · Concept · Junior
When modeling a problem as a graph, what should the vertices and edges represent?
Asked once · last asked Jan 27 · Concept · Mid-level
What is a B-tree index, and how does it work?
Asked once · last asked Feb 23 · Concept · Mid-level
Implement logic to traverse the hierarchical folder structure, check each folder for files, and print the name of every folder that contains files.
Asked once · last asked Jun 9 · Write code · Mid-level
How would you traverse a hierarchical folder structure, and would you use a for loop?
Asked once · last asked Jun 9 · Write code · Mid-level
How would you traverse subfolders and check whether they contain files?
Asked once · last asked Jun 9 · Write code · Mid-level
How would you process a hierarchical folder structure represented as JSON to identify folders that contain files?
Asked once · last asked Jun 9 · Write code · Mid-level
What is the time complexity of search, insertion, and deletion in a balanced binary search tree such as a red-black tree?
Asked once · last asked Jul 16 · Concept · Junior
Which hashes in a Merkle tree change when a transaction is modified?
Asked once · last asked Jul 8 · Concept · Junior
Given the preorder traversal of a binary search tree and an existing node class, how would you write a function to reconstruct and return the tree?
Asked once · last asked Nov 19 · Write code · Junior
How would you solve the Clone Graph problem?
Asked once · last asked Jul 25 · Write code · Mid-level
If you have a binary search tree, what would be the maximal depth of the tree containing 10 nodes?
Asked once · last asked Jul 27 · Concept · Junior
How are max heaps and min heaps used in practical applications?
Asked once · last asked Jul 27 · Concept · Junior
Other ways it was asked
- “Can you describe a practical use case for a min heap?”
Can you explain what heapifying down means and how it works in maintaining the min heap property?
Asked once · last asked Jul 27 · Concept · Mid-level
How do you perform a level order traversal of a binary tree?
Asked once · last asked Jul 27 · Concept · Junior
How would you handle duplicates if you were implementing a binary search tree?
Asked once · last asked Jul 27 · Scenario · Mid-level
Can you implement a function to find the kth largest element in a max heap? Please explain your steps.
Asked once · last asked Jul 27 · Write code · Mid-level
What should a function that finds the kth largest element in a max heap do if the heap is empty?
Asked once · last asked Jul 27 · Scenario · Junior
What is the time complexity of inserting an element in a max heap?
Asked once · last asked Jul 29 · Concept · Junior
What key benefits and trade-offs would lead you to choose HNSW indexing over other indexing options?
Asked once · last asked Jul 30 · Concept · Mid-level
Other ways it was asked
- “When selecting HNSW indexing over other options, what key benefits or considerations made it the right choice for your project?”
Can you create a tree representation in C++ with shapes stored in the nodes, then implement a post-order traversal, making production-style design choices and doing a little testing?
Asked once · last asked Aug 12 · Write code · Mid-level
In a directed graph, how do you detect a cycle efficiently, and how does your approach differ between using a DFS recursion stack and Kahn's algorithm?
Asked once · last asked Aug 13 · Concept · Mid-level
How does the order of a B-tree determine the maximum number of children per node?
Asked once · last asked Aug 27 · Concept · Junior
How would you store a graph in memory?
Asked once · last asked Sep 4 · Concept · Junior
How do adjacency lists and adjacency matrices compare for representing graphs?
Asked once · last asked Sep 4 · Concept · Junior
What is a strongly connected component in a directed graph?
Asked once · last asked Sep 4 · Concept · Junior
Which shortest-path algorithm can handle negative edge weights?
Asked once · last asked Sep 4 · Concept · Junior
Is Bellman-Ford a dynamic programming approach or a greedy approach?
Asked once · last asked Sep 4 · Concept · Junior
What is Kosaraju's algorithm, and how does it find strongly connected components?
Asked once · last asked Sep 4 · Concept · Junior
You have a BST with two nodes swapped by mistake. How would you recover it?
Asked once · last asked Sep 4 · Write code · Junior
What are the time and space complexities of a breadth-first search (BFS) approach?
Asked once · last asked Sep 4 · Concept · Mid-level
What is a B+ tree, and how does it work?
Asked once · last asked Sep 6 · Concept · Mid-level
Other ways it was asked
- “Explain the B+ tree algorithm.”
How would you find all nodes at distance k from a target node in a binary tree?
Asked once · last asked Sep 10 · Write code · Mid-level
Other ways it was asked
- “How would you handle duplicate values in a binary tree when finding nodes at distance k from a target?”
How would you use a parent map and queue to find all nodes at distance k from a target node in a binary tree?
Asked once · last asked Sep 10 · Scenario · Mid-level
Other ways it was asked
- “How do you plan to use the parent map and queue for finding nodes at distance k?”
How would a search for nodes at distance k from a target in a binary tree behave if the target is a leaf node and k is two?
Asked once · last asked Sep 10 · Scenario · Mid-level
Other ways it was asked
- “How would a distance-k search behave if the target is a leaf node and k is two?”
Why does a breadth-first search for nodes at distance k in a binary tree use a visited set?
Asked once · last asked Sep 10 · Concept · Mid-level
If k exceeds the tree's height, what should a distance-k search return, and why?
Asked once · last asked Sep 10 · Scenario · Mid-level
How would a depth-first search method for finding nodes at distance k in a binary tree differ from a breadth-first search method?
Asked once · last asked Sep 10 · Concept · Mid-level
How could you reduce the extra memory used by a breadth-first or depth-first approach for finding nodes at distance k in a binary tree?
Asked once · last asked Sep 10 · Scenario · Senior
How would you process a very large binary tree that cannot fit entirely in memory?
Asked once · last asked Sep 10 · Scenario · Senior
How would you prevent integer overflow when calculating path sums in a language with bounded integer types?
Asked once · last asked Sep 10 · Scenario · Mid-level
How should a binary-tree maximum path sum algorithm update the best sum when the maximum path does not pass through the root?
Asked once · last asked Sep 10 · Concept · Mid-level
Count islands in a grid using DFS, including diagonal connections, and explain the traversal and base cases.
Asked once · last asked Sep 10 · Write code · Mid-level
Other ways it was asked
- “What approach would you take to count the islands in a 2D grid, considering horizontal, vertical, and diagonal connections?”
- “In a DFS solution for counting islands in a 2D grid, what is the base case, and how would you structure the grid traversal?”
What invariant justifies that a node's distance is final when it is popped from the priority queue in Dijkstra's algorithm?
Asked once · last asked Sep 15 · Concept · Mid-level
Other ways it was asked
- “In Dijkstra's algorithm, why is a node's distance final when it is popped from the priority queue?”
What edge case or bug can cause an incorrect result in a first implementation of Dijkstra's algorithm, and how would you detect and fix it?
Asked once · last asked Sep 15 · Scenario · Mid-level
How would you approach finding the longest sequence of consecutive numbers in a graph that may contain cycles?
Asked once · last asked Sep 15 · Write code · Senior
How would you model an AGV traffic-control map using waypoints and edges?
Asked once · last asked Sep 25 · Design · Senior
When scheduling robot routes, how could you use cycle detection in a graph to identify potential deadlocks?
Asked once · last asked Sep 25 · Concept · Senior
Using zero-based indexing, what are the exact formulas for parent, left child, and right child in an array-backed binary heap?
Asked once · last asked Oct 4 · Concept · Junior
How do you create a min-heap of pairs using a priority queue?
Asked once · last asked Oct 15 · Concept · Junior
What is a Merkle proof?
Asked once · last asked Jul 8 · Concept · Junior
Other ways it was asked
- “What does a Merkle proof consist of, and who receives it?”
What is the difference between preorder and postorder traversal?
Asked once · last asked Sep 3 · Concept · Junior
What is a graph?
Asked once · last asked Jan 27 · Concept · Junior
What connects one vertex to another in a graph?
Asked once · last asked Jan 27 · Concept · Junior
Do graphs have a root, or is a root a concept specific to trees?
Asked once · last asked Jan 27 · Concept · Junior
What are Merkle trees used for?
Asked once · last asked Jul 8 · Concept · Junior
Can you explain what the BFS algorithm is and when it is used?
Asked once · last asked Jul 13 · Concept · Junior
What are in-order, pre-order, and post-order tree traversals?
Asked once · last asked Nov 19 · Concept · Junior
In a task graph, how would you define a child task?
Asked once · last asked Jul 22 · Concept · Mid-level
Describe the differences between a max heap and a min heap.
Asked once · last asked Jul 27 · Concept · Junior
Explain why level order traversal is useful.
Asked once · last asked Jul 27 · Concept · Junior
Give an example application of level order traversal.
Asked once · last asked Jul 27 · Concept · Junior
What happens if you insert a duplicate value into a binary search tree?
Asked once · last asked Jul 27 · Concept · Junior
What is a complete binary tree?
Asked once · last asked Jul 29 · Concept · Junior
Can you implement a graph algorithm?
Asked once · last asked Aug 17 · Write code · Mid-level
Are you aware of the heap data structure? How does it work?
Asked once · last asked Aug 20 · Concept · Junior
What are the types of heap data structures?
Asked once · last asked Aug 20 · Concept · Junior
What is the maximum number of children a node in a binary tree can have?
Asked once · last asked Aug 27 · Concept · Junior
Other ways it was asked
- “How many children can a binary tree have?”
Tell me about a binary tree.
Asked once · last asked Sep 1 · Concept · Junior
What is a graph in data structures?
Asked once · last asked Sep 4 · Concept · Junior
What is a tree in data structures?
Asked once · last asked Sep 4 · Concept · Junior
What is a dense graph?
Asked once · last asked Sep 4 · Concept · Junior
Describe a graph problem from a coding platform and explain how you would solve it.
Asked once · last asked Sep 4 · Write code · Junior
Other ways it was asked
- “Can you describe a graph problem you solved on a coding platform and explain your approach?”
What does mutual reachability mean for vertices in a strongly connected component?
Asked once · last asked Sep 4 · Concept · Junior
What are graphs used to represent, and why do we use graphs?
Asked once · last asked Sep 4 · Concept · Junior
What is the flood fill algorithm, and how is it used?
Asked once · last asked Sep 4 · Concept · Junior
What should a search for nodes at distance k from a target node in a binary tree return when k is zero?
Asked once · last asked Sep 10 · Scenario · Junior
Other ways it was asked
- “What should a distance-k search return when k is zero?”
How would you improve a solution to the binary-tree maximum path sum problem?
Asked once · last asked Sep 10 · Scenario · Mid-level
Other ways it was asked
- “What would you improve in your solution to the binary-tree maximum path sum problem?”
In a 2D grid island-counting problem, how is land defined?
Asked once · last asked Sep 10 · Concept · Junior
What test case would you use to test an island-counting algorithm that considers horizontal, vertical, and diagonal connections?
Asked once · last asked Sep 10 · Write code · Mid-level
What is the Traveling Salesman Problem?
Asked once · last asked Sep 22 · Concept · Junior
What is a directed graph?
Asked once · last asked Sep 30 · Concept · Junior
For a binary heap used by a priority_queue, how is the heap stored in memory?
Asked once · last asked Oct 4 · Concept · Junior
What is the difference between a heap and a graph?
Asked once · last asked Oct 9 · Concept · Junior
More Data Structures and Algorithms interview questions
- All Data Structures and Algorithms interview questions
- DSA Basics and Time Complexity Interview Questions
- Array and String Interview Questions
- Linked List, Stack and Queue Interview Questions
- Hash Map and Set Interview Questions
- Searching and Sorting Interview Questions
- Recursion, Dynamic Programming and Greedy Interview Questions
- Algorithm Design and Optimization Interview Questions
- Compiler, Math and Logic Puzzle Interview Questions
How this list is made
Every question here was asked by a real interviewer in a real job interview that a candidate ran MeetAssist in. After the call, the interviewer's questions are pulled from the transcript. Practice sessions, tests, exams and anything that was not a job interview are dropped.
Questions are rewritten so they make sense on their own: names of people, employers and clients are removed, and speech-to-text mistakes are fixed. Small talk, logistics and questions about one candidate's own résumé are left out. Rephrasings of the same question are merged, and the count is the number of different interviews it came up in.
The interviews come from candidates who use MeetAssist, so they lean towards software, data and AI roles: the shares describe these interviews, not every Data Structures and Algorithms interview. Answers to the most asked questions are written and checked by an editor; a "common mistake" is shown only when reviews of real answers in these interviews show it, with the count.
374 interviews, 269 candidates, Sep 2025 to Oct 2026. Updated every month with new interviews.
Or add the Chrome extension