100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace

Data Structures & Algorithms Interview Questions

Arrays, linked lists, stacks, queues, trees, graphs, sorting, searching and more.

227 questions

  1. 1. What is Big O Notation?

    easyAlgorithm Analysis 5 mins
  2. 2. Difference Between Array and Linked List

    easyData Structures 5 mins
  3. 3. What is a Hash Table?

    mediumData Structures 5 mins
  4. 4. What is Recursion?

    easyAlgorithms 5 mins
  5. 5. Difference Between Stack and Queue

    easyData Structures 4 mins
  6. 6. What is a Binary Search Tree (BST)?

    mediumData Structures 5 mins
  7. 7. What is Dynamic Programming?

    hardAlgorithms 6 mins
  8. 8. What is a Heap?

    mediumData Structures 5 mins
  9. 9. BFS vs DFS: What is the Difference?

    mediumGraph Algorithms 5 mins
  10. 10. What is a Trie?

    mediumData Structures 5 mins
  11. 11. Merge Sort vs Quick Sort: What is the Difference?

    mediumSorting Algorithms 6 mins
  12. 12. What is a Graph?

    easyGraph Algorithms 5 mins
  13. 13. What is a Doubly Linked List?

    easyData Structures 5 mins
  14. 14. What is Binary Search?

    easyAlgorithms 5 mins
  15. 15. What is a Priority Queue?

    mediumData Structures 6 mins
  16. 16. What is the Difference Between Time and Space Complexity?

    easyAlgorithm Analysis 5 mins
  17. 17. What is a Balanced Tree?

    mediumData Structures 6 mins
  18. 18. What is the Two Pointer Technique?

    easyAlgorithm Patterns 5 mins
  19. 19. What is the Sliding Window Technique?

    mediumAlgorithm Patterns 6 mins
  20. 20. What is Memoization?

    mediumDynamic Programming 5 mins
  21. 21. What is a Circular Queue?

    easyQueues 5 mins
  22. 22. What is Topological Sort?

    mediumGraphs 6 mins
  23. 23. What is Dijkstra’s Algorithm?

    mediumGraph Algorithms 5 mins
  24. 24. What is a Red-Black Tree?

    hardTrees 6 mins
  25. 25. Greedy vs Dynamic Programming: What is the Difference?

    mediumAlgorithm Design 5 mins
  26. 26. What is Backtracking?

    mediumAlgorithm Design 5 mins
  27. 27. What is a Hash Collision?

    easyHashing 4 mins
  28. 28. What is Heap Sort?

    mediumSorting Algorithms 5 mins
  29. 29. What is Counting Sort?

    easySorting Algorithms 5 mins
  30. 30. What is Radix Sort?

    mediumSorting Algorithms 6 mins
  31. 31. What is Bucket Sort?

    mediumSorting Algorithms 5 mins
  32. 32. What is Insertion Sort?

    easySorting Algorithms 4 mins
  33. 33. What is Selection Sort?

    easySorting Algorithms 5 mins
  34. 34. What is Shell Sort?

    mediumSorting Algorithms 6 mins
  35. 35. What is Timsort?

    hardSorting Algorithms 6 mins
  36. 36. What is Bubble Sort?

    easySorting Algorithms 4 mins
  37. 37. Stable vs Unstable Sort: What is the Difference?

    mediumSorting Algorithms 5 mins
  38. 38. Solve the Two Sum Problem

    easyArrays & Hashing 5 mins
  39. 39. What is Kadane's Algorithm?

    mediumDynamic Programming 6 mins
  40. 40. What is the Dutch National Flag Problem?

    mediumArrays & Sorting 6 mins
  41. 41. How Would You Design an LRU Cache?

    hardDesign & Data Structures 6 mins
  42. 42. How Do You Solve the Trapping Rain Water Problem?

    hardArrays & Two Pointers 6 mins
  43. 43. N-Queens Problem: How Would You Solve It?

    hardBacktracking 6 mins
  44. 44. 0/1 Knapsack Problem: How Would You Solve It?

    mediumDynamic Programming 6 mins
  45. 45. Unbounded Knapsack Problem: How Is It Different?

    mediumDynamic Programming 6 mins
  46. 46. Coin Change Problem: How Would You Solve It?

    mediumDynamic Programming 6 mins
  47. 47. Edit Distance Problem: How Would You Solve It?

    hardDynamic Programming 6 mins
  48. 48. How Do You Find the Longest Common Subsequence?

    mediumDynamic Programming 6 mins
  49. 49. How Do You Find the Longest Increasing Subsequence?

    mediumDynamic Programming 6 mins
  50. 50. How Do You Find the Longest Common Substring?

    mediumDynamic Programming 6 mins
  51. 51. How Do You Solve the Subset Sum Problem?

    mediumDynamic Programming 6 mins
  52. 52. How Do You Solve Partition Equal Subset Sum?

    mediumDynamic Programming 6 mins
  53. 53. What is the Bellman-Ford Algorithm?

    mediumGraph Algorithms 6 mins
  54. 54. What is the Floyd-Warshall Algorithm?

    mediumGraph Algorithms 6 mins
  55. 55. What is Kruskal's Algorithm?

    mediumGraph Algorithms 6 mins
  56. 56. What is Prim's Algorithm?

    mediumGraph Algorithms 6 mins
  57. 57. What is the A* Search Algorithm?

    mediumGraph Algorithms 6 mins
  58. 58. What is Union-Find (Disjoint Set Union)?

    mediumData Structures 5 mins
  59. 59. What is Kosaraju's Algorithm?

    hardGraph Algorithms 6 mins
  60. 60. What is Tarjan's Algorithm?

    hardGraph Algorithms 6 mins
  61. 61. What is an AVL Tree?

    mediumData Structures 5 mins
  62. 62. What is a Segment Tree?

    hardData Structures 6 mins
  63. 63. What is a Fenwick Tree (Binary Indexed Tree)?

    hardData Structures 6 mins
  64. 64. What is a B-Tree?

    hardData Structures 6 mins
  65. 65. What is a Suffix Tree?

    hardString Algorithms 6 mins
  66. 66. What is the Lowest Common Ancestor (LCA) Problem?

    mediumTrees 5 mins
  67. 67. What are Inorder, Preorder, and Postorder Tree Traversals?

    easyTrees 5 mins
  68. 68. What is Level-Order Tree Traversal?

    easyTree Traversal 5 mins
  69. 69. What is the KMP String Matching Algorithm?

    hardString Algorithms 6 mins
  70. 70. What is the Rabin-Karp Algorithm?

    mediumString Algorithms 6 mins
  71. 71. What is Manacher's Algorithm?

    hardString Algorithms 6 mins
  72. 72. What is the Z-Algorithm for String Matching?

    hardString Algorithms 6 mins
  73. 73. What is Amortized Analysis?

    mediumComplexity Analysis 5 mins
  74. 74. How Do You Prove a Greedy Algorithm is Correct?

    hardAlgorithm Design 6 mins
  75. 75. What is the Divide and Conquer Strategy?

    mediumAlgorithm Design 5 mins
  76. 76. What is a Min-Heap?

    easyData Structures 5 mins
  77. 77. What is a Max-Heap?

    easyData Structures 5 mins
  78. 78. What is Hashing with Chaining?

    mediumHashing 5 mins
  79. 79. What is Hashing with Open Addressing?

    mediumHashing 6 mins
  80. 80. What is a Bloom Filter?

    hardProbabilistic Data Structures 6 mins
  81. 81. What is a Skip List?

    hardData Structures 6 mins
  82. 82. What is a Splay Tree?

    hardData Structures 6 mins
  83. 83. What Are the Core Bit Manipulation Operators and When Do You Use Them?

    easyBit Manipulation 5 mins
  84. 84. How Does the XOR Swap Technique Work, and Should You Actually Use It?

    mediumBit Manipulation 5 mins
  85. 85. How Do You Count the Number of Set Bits in an Integer Efficiently?

    mediumBit Manipulation 5 mins
  86. 86. How Do You Find the Number of Subarrays That Sum to K?

    mediumArrays & Hashing 6 mins
  87. 87. How Do You Find the Maximum in Every Sliding Window of Size K?

    hardArrays & Hashing 6 mins
  88. 88. Minimum Window Substring: How Do You Solve It?

    hardSliding Window 6 mins
  89. 89. Longest Substring Without Repeating Characters

    mediumSliding Window 5 mins
  90. 90. How Do You Solve the Valid Parentheses Problem?

    easyStacks 4 mins
  91. 91. Next Greater Element: How Do You Solve It?

    mediumStacks 5 mins
  92. 92. What is the Monotonic Stack Technique?

    mediumStacks 6 mins
  93. 93. What is the Monotonic Queue Technique?

    hardSliding Window 6 mins
  94. 94. How Do You Find the Median of Two Sorted Arrays?

    hardBinary Search 6 mins
  95. 95. How Do You Find the Kth Largest Element in an Array?

    mediumSorting Algorithms 6 mins
  96. 96. How Do You Merge K Sorted Linked Lists?

    hardLinked Lists 6 mins
  97. 97. How Do You Reverse a Linked List in Groups of K?

    mediumLinked Lists 5 mins
  98. 98. How Do You Detect a Cycle in a Linked List?

    mediumLinked Lists 5 mins
  99. 99. What is Floyd’s Cycle Detection Algorithm?

    mediumLinked Lists 6 mins
  100. 100. How Do You Find the Middle of a Linked List?

    easyLinked Lists 5 mins
  101. 101. How Do You Clone a Linked List with a Random Pointer?

    hardLinked Lists 6 mins
  102. 102. How Do You Flatten a Multilevel Linked List?

    hardLinked Lists 6 mins
  103. 103. How Would You Implement a Stack Using Queues?

    mediumData Structures 5 mins
  104. 104. How Would You Implement a Queue Using Stacks?

    mediumData Structures 5 mins
  105. 105. How Would You Design a Min Stack?

    mediumData Structures 5 mins
  106. 106. How Would You Evaluate Reverse Polish Notation?

    mediumStacks & Expression Evaluation 5 mins
  107. 107. How Does the Next Permutation Algorithm Work?

    hardArrays & Combinatorics 6 mins
  108. 108. How Do You Rotate an Array by K Positions?

    mediumArrays 5 mins
  109. 109. How Do You Rotate a Matrix 90 Degrees In Place?

    mediumArrays 5 mins
  110. 110. How Do You Traverse a Matrix in Spiral Order?

    mediumArrays 6 mins
  111. 111. How Do You Search in a Rotated Sorted Array?

    mediumBinary Search 6 mins
  112. 112. How Do You Find a Peak Element in an Array?

    mediumBinary Search 5 mins
  113. 113. What is Binary Search on the Answer?

    mediumSearch Algorithms 5 mins
  114. 114. What is Ternary Search?

    mediumSearch Algorithms 5 mins
  115. 115. What is Exponential Search?

    mediumSearch Algorithms 5 mins
  116. 116. What is Interpolation Search?

    mediumSearch Algorithms 5 mins
  117. 117. What is Jump Search?

    easySearch Algorithms 4 mins
  118. 118. Word Ladder Problem: How Would You Solve It?

    hardGraph Algorithms 6 mins
  119. 119. Word Search Problem: How Would You Solve It?

    mediumBacktracking 5 mins
  120. 120. Number of Islands Problem: How Would You Solve It?

    mediumGraph Algorithms 5 mins
  121. 121. What is the Flood Fill Algorithm?

    easyGraph Algorithms 5 mins
  122. 122. Course Schedule Problem: How Would You Solve It?

    mediumGraph Algorithms 6 mins
  123. 123. What is the Graph Coloring Problem?

    hardGraph Algorithms 6 mins
  124. 124. What is the Hamiltonian Path Problem?

    hardGraph Algorithms 6 mins
  125. 125. What is the Traveling Salesman Problem?

    hardGraph Algorithms 6 mins
  126. 126. What is a Minimum Spanning Tree?

    mediumGraph Algorithms 5 mins
  127. 127. How Do You Find the Shortest Path in an Unweighted Graph?

    mediumGraph Algorithms 5 mins
  128. 128. What is the Single-Source Shortest Path Problem?

    mediumGraph Algorithms 6 mins
  129. 129. What is the All-Pairs Shortest Path Problem?

    hardGraph Algorithms 6 mins
  130. 130. What are Strongly Connected Components?

    hardGraph Algorithms 6 mins
  131. 131. What are Articulation Points and Bridges in a Graph?

    hardGraph Algorithms 6 mins
  132. 132. What is an Eulerian Path and Eulerian Circuit?

    mediumGraph Algorithms 6 mins
  133. 133. How Do You Check if a Graph is Bipartite?

    mediumGraph Algorithms 5 mins
  134. 134. How Do You Detect a Cycle in a Directed Graph?

    mediumGraph Algorithms 5 mins
  135. 135. How Do You Detect a Cycle in an Undirected Graph?

    mediumGraph Algorithms 5 mins
  136. 136. What is Topological Sort and How Does Kahn's Algorithm Work?

    mediumGraph Algorithms 6 mins
  137. 137. What is a Disjoint Set Union with Path Compression?

    mediumData Structures 6 mins
  138. 138. How Would You Build Autocomplete Using a Trie?

    mediumData Structures 6 mins
  139. 139. How Do You Construct a Suffix Array?

    hardString Algorithms 6 mins
  140. 140. How Do You Find the Longest Palindromic Substring?

    mediumString Algorithms 5 mins
  141. 141. How Do You Solve the Palindrome Partitioning Problem?

    hardDynamic Programming 6 mins
  142. 142. How Does Matrix Chain Multiplication Work?

    hardDynamic Programming 6 mins
  143. 143. What is the Rod Cutting Problem?

    mediumDynamic Programming 5 mins
  144. 144. What is the Egg Drop Problem?

    hardDynamic Programming 6 mins
  145. 145. What is the Boolean Parenthesization Problem?

    hardDynamic Programming 6 mins
  146. 146. What are Catalan Numbers and Their Applications?

    mediumCombinatorics & Dynamic Programming 6 mins
  147. 147. How Do You Solve Fibonacci with Dynamic Programming?

    easyDynamic Programming 4 mins
  148. 148. Climbing Stairs Problem: How Do You Solve It?

    easyDynamic Programming 5 mins
  149. 149. House Robber Problem: How Do You Solve It?

    mediumDynamic Programming 6 mins
  150. 150. Jump Game Problem: How Do You Solve It?

    mediumDynamic Programming 6 mins
  151. 151. Word Break Problem: How Do You Solve It?

    mediumDynamic Programming 6 mins
  152. 152. Decode Ways Problem: How Do You Solve It?

    mediumDynamic Programming 6 mins
  153. 153. What is the Minimum Path Sum Problem?

    mediumDynamic Programming 5 mins
  154. 154. What is the Unique Paths Problem?

    mediumDynamic Programming 5 mins
  155. 155. What is the Maximal Square Problem?

    hardDynamic Programming 6 mins
  156. 156. How Do You Solve Largest Rectangle in Histogram?

    hardStacks 6 mins
  157. 157. What is the Container With Most Water Problem?

    mediumTwo Pointers 5 mins
  158. 158. How Do You Solve the Three Sum Problem?

    mediumArrays & Two Pointers 5 mins
  159. 159. How Do You Solve the Four Sum Problem?

    mediumArrays & Two Pointers 5 mins
  160. 160. How Do You Find a Subarray With a Given Sum?

    mediumArrays & Sliding Window 5 mins
  161. 161. What is the Majority Element Problem?

    easyArrays & Algorithm Design 5 mins
  162. 162. How Does the Boyer-Moore Voting Algorithm Work?

    mediumAlgorithm Design 5 mins
  163. 163. What is the Quickselect Algorithm?

    mediumSelection Algorithms 5 mins
  164. 164. What is Reservoir Sampling?

    hardRandomized Algorithms 6 mins
  165. 165. What is the Fisher-Yates Shuffle Algorithm?

    mediumRandomized Algorithms 5 mins
  166. 166. What is Morris Traversal?

    hardTree Algorithms 6 mins
  167. 167. What is a Threaded Binary Tree?

    mediumTree Data Structures 5 mins
  168. 168. Red-Black Tree vs AVL Tree: What is the Difference?

    hardBalanced Trees 6 mins
  169. 169. What is a B+ Tree and Why Do Databases Use It?

    hardTree Data Structures 6 mins
  170. 170. What is a Treap and How Does It Balance Itself?

    hardRandomized Data Structures 6 mins
  171. 171. What is a Cartesian Tree and What Is It Used For?

    hardTree Data Structures 6 mins
  172. 172. What is a Van Emde Boas Tree and Why Is It So Fast?

    hardAdvanced Data Structures 6 mins
  173. 173. What is the Interval Scheduling Problem?

    mediumGreedy Algorithms 5 mins
  174. 174. How Do You Solve the Merge Intervals Problem?

    mediumSorting & Intervals 5 mins
  175. 175. How Do You Solve the Insert Interval Problem?

    mediumSorting & Intervals 5 mins
  176. 176. How Do You Solve the Meeting Rooms Problem?

    mediumHeaps & Intervals 6 mins
  177. 177. What is the Activity Selection Problem?

    easyGreedy Algorithms 5 mins
  178. 178. What is the Huffman Coding Algorithm?

    mediumGreedy Algorithms 6 mins
  179. 179. What is Job Sequencing with Deadlines?

    mediumGreedy Algorithms 6 mins
  180. 180. What is the Fractional Knapsack Problem?

    mediumGreedy Algorithms 6 mins
  181. 181. How Does Greedy Choice Relate to Optimal Substructure?

    hardAlgorithm Design Principles 6 mins
  182. 182. How Do You Optimize Space in Dynamic Programming?

    hardDynamic Programming 6 mins
  183. 183. Top-Down vs Bottom-Up Dynamic Programming: What is the Difference?

    mediumDynamic Programming 5 mins
  184. 184. Tabulation vs Memoization: How Do They Differ in Dynamic Programming?

    easyDynamic Programming 4 mins
  185. 185. What is State Space Reduction in Dynamic Programming?

    hardDynamic Programming 6 mins
  186. 186. What is Bitmask Dynamic Programming?

    hardDynamic Programming 6 mins
  187. 187. What is Digit Dynamic Programming (Digit DP)?

    hardDynamic Programming 6 mins
  188. 188. What is Tree Dynamic Programming?

    hardDynamic Programming 6 mins
  189. 189. What is Dynamic Programming on Graphs?

    hardDynamic Programming 6 mins
  190. 190. Iterative vs Recursive Algorithms: What is the Difference?

    mediumAlgorithm Design 5 mins
  191. 191. What is Tail Recursion?

    mediumAlgorithm Design 5 mins
  192. 192. What is the Master Theorem?

    hardAlgorithm Analysis 6 mins
  193. 193. What is a Recurrence Relation in Algorithm Analysis?

    mediumAlgorithm Analysis 6 mins
  194. 194. What Does NP-Complete Mean?

    hardComplexity Theory 6 mins
  195. 195. What is the P vs NP Problem?

    hardComplexity Theory 6 mins
  196. 196. What is the Difference Between NP-Hard and NP-Complete?

    hardComplexity Theory 6 mins
  197. 197. What are Approximation Algorithms and When Do You Use Them?

    hardAlgorithm Design 6 mins
  198. 198. What are Randomized Algorithms?

    mediumAlgorithm Design 6 mins
  199. 199. What are Online Algorithms?

    mediumAlgorithm Design 6 mins
  200. 200. What is External Sorting?

    mediumSorting Algorithms 6 mins
  201. 201. What are Cache-Oblivious Algorithms?

    hardAlgorithm Design 6 mins
  202. 202. What Makes a Data Structure Cache-Friendly?

    mediumData Structures 6 mins
  203. 203. What Are Lock-Free Data Structures?

    hardConcurrency 6 mins
  204. 204. How Would You Design a Concurrent Hash Map?

    hardConcurrency 6 mins
  205. 205. What is Consistent Hashing and Why is it Used?

    mediumDistributed Systems 5 mins
  206. 206. What is a Count-Min Sketch and When Would You Use One?

    hardProbabilistic Data Structures 6 mins
  207. 207. Skip List vs Balanced Tree: When Would You Use Each?

    hardData Structures 6 mins
  208. 208. What is Heavy-Light Decomposition?

    hardTrees 6 mins
  209. 209. What is the Sparse Table Technique?

    mediumRange Queries 5 mins
  210. 210. What is Mo's Algorithm?

    hardRange Queries 6 mins
  211. 211. What are Persistent Data Structures?

    hardAdvanced Data Structures 6 mins
  212. 212. What is a Disjoint Sparse Table?

    hardRange Queries 6 mins
  213. 213. Knuth-Morris-Pratt vs Rabin-Karp: What is the Difference?

    hardString Algorithms 6 mins
  214. 214. What is the Aho-Corasick Algorithm?

    hardString Algorithms 6 mins
  215. 215. What is a Suffix Automaton?

    hardString Algorithms 6 mins
  216. 216. How Do You Solve the Longest Repeated Substring Problem?

    hardString Algorithms 6 mins
  217. 217. What is String Hashing and How Is It Used?

    mediumString Algorithms 5 mins
  218. 218. Array of Arrays vs a True 2D Array: What is the Difference?

    mediumArrays 5 mins
  219. 219. Static Arrays vs Dynamic Arrays: What is the Difference?

    easyArrays 5 mins
  220. 220. What is a Circular Buffer (Ring Buffer)?

    mediumData Structures 5 mins
  221. 221. How Would You Represent a Sparse Matrix Efficiently?

    mediumData Structures 6 mins
  222. 222. Adjacency List vs Adjacency Matrix: When Would You Use Each?

    mediumGraph Algorithms 6 mins
  223. 223. What Are the Main Graph Representation Techniques?

    mediumGraph Algorithms 5 mins
  224. 224. Weighted vs Unweighted Graphs: What is the Difference?

    easyGraph Algorithms 5 mins
  225. 225. Directed vs Undirected Graphs: What is the Difference?

    easyGraph Algorithms 5 mins
  226. 226. In-Place vs Out-of-Place Algorithms: What is the Difference?

    mediumAlgorithm Design 5 mins
  227. 227. Online vs Offline Algorithms: What is the Difference?

    mediumAlgorithm Design 6 mins