Data Structures & Algorithms Interview Questions
Arrays, linked lists, stacks, queues, trees, graphs, sorting, searching and more.
227 questions
Popular Searches
1. What is Big O Notation?
easyAlgorithm Analysis 5 mins2. Difference Between Array and Linked List
easyData Structures 5 mins3. What is a Hash Table?
mediumData Structures 5 mins4. What is Recursion?
easyAlgorithms 5 mins5. Difference Between Stack and Queue
easyData Structures 4 mins6. What is a Binary Search Tree (BST)?
mediumData Structures 5 mins7. What is Dynamic Programming?
hardAlgorithms 6 mins8. What is a Heap?
mediumData Structures 5 mins9. BFS vs DFS: What is the Difference?
mediumGraph Algorithms 5 mins10. What is a Trie?
mediumData Structures 5 mins11. Merge Sort vs Quick Sort: What is the Difference?
mediumSorting Algorithms 6 mins12. What is a Graph?
easyGraph Algorithms 5 mins13. What is a Doubly Linked List?
easyData Structures 5 mins14. What is Binary Search?
easyAlgorithms 5 mins15. What is a Priority Queue?
mediumData Structures 6 mins16. What is the Difference Between Time and Space Complexity?
easyAlgorithm Analysis 5 mins17. What is a Balanced Tree?
mediumData Structures 6 mins18. What is the Two Pointer Technique?
easyAlgorithm Patterns 5 mins19. What is the Sliding Window Technique?
mediumAlgorithm Patterns 6 mins20. What is Memoization?
mediumDynamic Programming 5 mins21. What is a Circular Queue?
easyQueues 5 mins22. What is Topological Sort?
mediumGraphs 6 mins23. What is Dijkstra’s Algorithm?
mediumGraph Algorithms 5 mins24. What is a Red-Black Tree?
hardTrees 6 mins25. Greedy vs Dynamic Programming: What is the Difference?
mediumAlgorithm Design 5 mins26. What is Backtracking?
mediumAlgorithm Design 5 mins27. What is a Hash Collision?
easyHashing 4 mins28. What is Heap Sort?
mediumSorting Algorithms 5 mins29. What is Counting Sort?
easySorting Algorithms 5 mins30. What is Radix Sort?
mediumSorting Algorithms 6 mins31. What is Bucket Sort?
mediumSorting Algorithms 5 mins32. What is Insertion Sort?
easySorting Algorithms 4 mins33. What is Selection Sort?
easySorting Algorithms 5 mins34. What is Shell Sort?
mediumSorting Algorithms 6 mins35. What is Timsort?
hardSorting Algorithms 6 mins36. What is Bubble Sort?
easySorting Algorithms 4 mins37. Stable vs Unstable Sort: What is the Difference?
mediumSorting Algorithms 5 mins38. Solve the Two Sum Problem
easyArrays & Hashing 5 mins39. What is Kadane's Algorithm?
mediumDynamic Programming 6 mins40. What is the Dutch National Flag Problem?
mediumArrays & Sorting 6 mins41. How Would You Design an LRU Cache?
hardDesign & Data Structures 6 mins42. How Do You Solve the Trapping Rain Water Problem?
hardArrays & Two Pointers 6 mins43. N-Queens Problem: How Would You Solve It?
hardBacktracking 6 mins44. 0/1 Knapsack Problem: How Would You Solve It?
mediumDynamic Programming 6 mins45. Unbounded Knapsack Problem: How Is It Different?
mediumDynamic Programming 6 mins46. Coin Change Problem: How Would You Solve It?
mediumDynamic Programming 6 mins47. Edit Distance Problem: How Would You Solve It?
hardDynamic Programming 6 mins48. How Do You Find the Longest Common Subsequence?
mediumDynamic Programming 6 mins49. How Do You Find the Longest Increasing Subsequence?
mediumDynamic Programming 6 mins50. How Do You Find the Longest Common Substring?
mediumDynamic Programming 6 mins51. How Do You Solve the Subset Sum Problem?
mediumDynamic Programming 6 mins52. How Do You Solve Partition Equal Subset Sum?
mediumDynamic Programming 6 mins53. What is the Bellman-Ford Algorithm?
mediumGraph Algorithms 6 mins54. What is the Floyd-Warshall Algorithm?
mediumGraph Algorithms 6 mins55. What is Kruskal's Algorithm?
mediumGraph Algorithms 6 mins56. What is Prim's Algorithm?
mediumGraph Algorithms 6 mins57. What is the A* Search Algorithm?
mediumGraph Algorithms 6 mins58. What is Union-Find (Disjoint Set Union)?
mediumData Structures 5 mins59. What is Kosaraju's Algorithm?
hardGraph Algorithms 6 mins60. What is Tarjan's Algorithm?
hardGraph Algorithms 6 mins61. What is an AVL Tree?
mediumData Structures 5 mins62. What is a Segment Tree?
hardData Structures 6 mins63. What is a Fenwick Tree (Binary Indexed Tree)?
hardData Structures 6 mins64. What is a B-Tree?
hardData Structures 6 mins65. What is a Suffix Tree?
hardString Algorithms 6 mins66. What is the Lowest Common Ancestor (LCA) Problem?
mediumTrees 5 mins67. What are Inorder, Preorder, and Postorder Tree Traversals?
easyTrees 5 mins68. What is Level-Order Tree Traversal?
easyTree Traversal 5 mins69. What is the KMP String Matching Algorithm?
hardString Algorithms 6 mins70. What is the Rabin-Karp Algorithm?
mediumString Algorithms 6 mins71. What is Manacher's Algorithm?
hardString Algorithms 6 mins72. What is the Z-Algorithm for String Matching?
hardString Algorithms 6 mins73. What is Amortized Analysis?
mediumComplexity Analysis 5 mins74. How Do You Prove a Greedy Algorithm is Correct?
hardAlgorithm Design 6 mins75. What is the Divide and Conquer Strategy?
mediumAlgorithm Design 5 mins76. What is a Min-Heap?
easyData Structures 5 mins77. What is a Max-Heap?
easyData Structures 5 mins78. What is Hashing with Chaining?
mediumHashing 5 mins79. What is Hashing with Open Addressing?
mediumHashing 6 mins80. What is a Bloom Filter?
hardProbabilistic Data Structures 6 mins81. What is a Skip List?
hardData Structures 6 mins82. What is a Splay Tree?
hardData Structures 6 mins83. What Are the Core Bit Manipulation Operators and When Do You Use Them?
easyBit Manipulation 5 mins84. How Does the XOR Swap Technique Work, and Should You Actually Use It?
mediumBit Manipulation 5 mins85. How Do You Count the Number of Set Bits in an Integer Efficiently?
mediumBit Manipulation 5 mins86. How Do You Find the Number of Subarrays That Sum to K?
mediumArrays & Hashing 6 mins87. How Do You Find the Maximum in Every Sliding Window of Size K?
hardArrays & Hashing 6 mins88. Minimum Window Substring: How Do You Solve It?
hardSliding Window 6 mins89. Longest Substring Without Repeating Characters
mediumSliding Window 5 mins90. How Do You Solve the Valid Parentheses Problem?
easyStacks 4 mins91. Next Greater Element: How Do You Solve It?
mediumStacks 5 mins92. What is the Monotonic Stack Technique?
mediumStacks 6 mins93. What is the Monotonic Queue Technique?
hardSliding Window 6 mins94. How Do You Find the Median of Two Sorted Arrays?
hardBinary Search 6 mins95. How Do You Find the Kth Largest Element in an Array?
mediumSorting Algorithms 6 mins96. How Do You Merge K Sorted Linked Lists?
hardLinked Lists 6 mins97. How Do You Reverse a Linked List in Groups of K?
mediumLinked Lists 5 mins98. How Do You Detect a Cycle in a Linked List?
mediumLinked Lists 5 mins99. What is Floyd’s Cycle Detection Algorithm?
mediumLinked Lists 6 mins100. How Do You Find the Middle of a Linked List?
easyLinked Lists 5 mins101. How Do You Clone a Linked List with a Random Pointer?
hardLinked Lists 6 mins102. How Do You Flatten a Multilevel Linked List?
hardLinked Lists 6 mins103. How Would You Implement a Stack Using Queues?
mediumData Structures 5 mins104. How Would You Implement a Queue Using Stacks?
mediumData Structures 5 mins105. How Would You Design a Min Stack?
mediumData Structures 5 mins106. How Would You Evaluate Reverse Polish Notation?
mediumStacks & Expression Evaluation 5 mins107. How Does the Next Permutation Algorithm Work?
hardArrays & Combinatorics 6 mins108. How Do You Rotate an Array by K Positions?
mediumArrays 5 mins109. How Do You Rotate a Matrix 90 Degrees In Place?
mediumArrays 5 mins110. How Do You Traverse a Matrix in Spiral Order?
mediumArrays 6 mins111. How Do You Search in a Rotated Sorted Array?
mediumBinary Search 6 mins112. How Do You Find a Peak Element in an Array?
mediumBinary Search 5 mins113. What is Binary Search on the Answer?
mediumSearch Algorithms 5 mins114. What is Ternary Search?
mediumSearch Algorithms 5 mins115. What is Exponential Search?
mediumSearch Algorithms 5 mins116. What is Interpolation Search?
mediumSearch Algorithms 5 mins117. What is Jump Search?
easySearch Algorithms 4 mins118. Word Ladder Problem: How Would You Solve It?
hardGraph Algorithms 6 mins119. Word Search Problem: How Would You Solve It?
mediumBacktracking 5 mins120. Number of Islands Problem: How Would You Solve It?
mediumGraph Algorithms 5 mins121. What is the Flood Fill Algorithm?
easyGraph Algorithms 5 mins122. Course Schedule Problem: How Would You Solve It?
mediumGraph Algorithms 6 mins123. What is the Graph Coloring Problem?
hardGraph Algorithms 6 mins124. What is the Hamiltonian Path Problem?
hardGraph Algorithms 6 mins125. What is the Traveling Salesman Problem?
hardGraph Algorithms 6 mins126. What is a Minimum Spanning Tree?
mediumGraph Algorithms 5 mins127. How Do You Find the Shortest Path in an Unweighted Graph?
mediumGraph Algorithms 5 mins128. What is the Single-Source Shortest Path Problem?
mediumGraph Algorithms 6 mins129. What is the All-Pairs Shortest Path Problem?
hardGraph Algorithms 6 mins130. What are Strongly Connected Components?
hardGraph Algorithms 6 mins131. What are Articulation Points and Bridges in a Graph?
hardGraph Algorithms 6 mins132. What is an Eulerian Path and Eulerian Circuit?
mediumGraph Algorithms 6 mins133. How Do You Check if a Graph is Bipartite?
mediumGraph Algorithms 5 mins134. How Do You Detect a Cycle in a Directed Graph?
mediumGraph Algorithms 5 mins135. How Do You Detect a Cycle in an Undirected Graph?
mediumGraph Algorithms 5 mins136. What is Topological Sort and How Does Kahn's Algorithm Work?
mediumGraph Algorithms 6 mins137. What is a Disjoint Set Union with Path Compression?
mediumData Structures 6 mins138. How Would You Build Autocomplete Using a Trie?
mediumData Structures 6 mins139. How Do You Construct a Suffix Array?
hardString Algorithms 6 mins140. How Do You Find the Longest Palindromic Substring?
mediumString Algorithms 5 mins141. How Do You Solve the Palindrome Partitioning Problem?
hardDynamic Programming 6 mins142. How Does Matrix Chain Multiplication Work?
hardDynamic Programming 6 mins143. What is the Rod Cutting Problem?
mediumDynamic Programming 5 mins144. What is the Egg Drop Problem?
hardDynamic Programming 6 mins145. What is the Boolean Parenthesization Problem?
hardDynamic Programming 6 mins146. What are Catalan Numbers and Their Applications?
mediumCombinatorics & Dynamic Programming 6 mins147. How Do You Solve Fibonacci with Dynamic Programming?
easyDynamic Programming 4 mins148. Climbing Stairs Problem: How Do You Solve It?
easyDynamic Programming 5 mins149. House Robber Problem: How Do You Solve It?
mediumDynamic Programming 6 mins150. Jump Game Problem: How Do You Solve It?
mediumDynamic Programming 6 mins151. Word Break Problem: How Do You Solve It?
mediumDynamic Programming 6 mins152. Decode Ways Problem: How Do You Solve It?
mediumDynamic Programming 6 mins153. What is the Minimum Path Sum Problem?
mediumDynamic Programming 5 mins154. What is the Unique Paths Problem?
mediumDynamic Programming 5 mins155. What is the Maximal Square Problem?
hardDynamic Programming 6 mins156. How Do You Solve Largest Rectangle in Histogram?
hardStacks 6 mins157. What is the Container With Most Water Problem?
mediumTwo Pointers 5 mins158. How Do You Solve the Three Sum Problem?
mediumArrays & Two Pointers 5 mins159. How Do You Solve the Four Sum Problem?
mediumArrays & Two Pointers 5 mins160. How Do You Find a Subarray With a Given Sum?
mediumArrays & Sliding Window 5 mins161. What is the Majority Element Problem?
easyArrays & Algorithm Design 5 mins162. How Does the Boyer-Moore Voting Algorithm Work?
mediumAlgorithm Design 5 mins163. What is the Quickselect Algorithm?
mediumSelection Algorithms 5 mins164. What is Reservoir Sampling?
hardRandomized Algorithms 6 mins165. What is the Fisher-Yates Shuffle Algorithm?
mediumRandomized Algorithms 5 mins166. What is Morris Traversal?
hardTree Algorithms 6 mins167. What is a Threaded Binary Tree?
mediumTree Data Structures 5 mins168. Red-Black Tree vs AVL Tree: What is the Difference?
hardBalanced Trees 6 mins169. What is a B+ Tree and Why Do Databases Use It?
hardTree Data Structures 6 mins170. What is a Treap and How Does It Balance Itself?
hardRandomized Data Structures 6 mins171. What is a Cartesian Tree and What Is It Used For?
hardTree Data Structures 6 mins172. What is a Van Emde Boas Tree and Why Is It So Fast?
hardAdvanced Data Structures 6 mins173. What is the Interval Scheduling Problem?
mediumGreedy Algorithms 5 mins174. How Do You Solve the Merge Intervals Problem?
mediumSorting & Intervals 5 mins175. How Do You Solve the Insert Interval Problem?
mediumSorting & Intervals 5 mins176. How Do You Solve the Meeting Rooms Problem?
mediumHeaps & Intervals 6 mins177. What is the Activity Selection Problem?
easyGreedy Algorithms 5 mins178. What is the Huffman Coding Algorithm?
mediumGreedy Algorithms 6 mins179. What is Job Sequencing with Deadlines?
mediumGreedy Algorithms 6 mins180. What is the Fractional Knapsack Problem?
mediumGreedy Algorithms 6 mins181. How Does Greedy Choice Relate to Optimal Substructure?
hardAlgorithm Design Principles 6 mins182. How Do You Optimize Space in Dynamic Programming?
hardDynamic Programming 6 mins183. Top-Down vs Bottom-Up Dynamic Programming: What is the Difference?
mediumDynamic Programming 5 mins184. Tabulation vs Memoization: How Do They Differ in Dynamic Programming?
easyDynamic Programming 4 mins185. What is State Space Reduction in Dynamic Programming?
hardDynamic Programming 6 mins186. What is Bitmask Dynamic Programming?
hardDynamic Programming 6 mins187. What is Digit Dynamic Programming (Digit DP)?
hardDynamic Programming 6 mins188. What is Tree Dynamic Programming?
hardDynamic Programming 6 mins189. What is Dynamic Programming on Graphs?
hardDynamic Programming 6 mins190. Iterative vs Recursive Algorithms: What is the Difference?
mediumAlgorithm Design 5 mins191. What is Tail Recursion?
mediumAlgorithm Design 5 mins192. What is the Master Theorem?
hardAlgorithm Analysis 6 mins193. What is a Recurrence Relation in Algorithm Analysis?
mediumAlgorithm Analysis 6 mins194. What Does NP-Complete Mean?
hardComplexity Theory 6 mins195. What is the P vs NP Problem?
hardComplexity Theory 6 mins196. What is the Difference Between NP-Hard and NP-Complete?
hardComplexity Theory 6 mins197. What are Approximation Algorithms and When Do You Use Them?
hardAlgorithm Design 6 mins198. What are Randomized Algorithms?
mediumAlgorithm Design 6 mins199. What are Online Algorithms?
mediumAlgorithm Design 6 mins200. What is External Sorting?
mediumSorting Algorithms 6 mins201. What are Cache-Oblivious Algorithms?
hardAlgorithm Design 6 mins202. What Makes a Data Structure Cache-Friendly?
mediumData Structures 6 mins203. What Are Lock-Free Data Structures?
hardConcurrency 6 mins204. How Would You Design a Concurrent Hash Map?
hardConcurrency 6 mins205. What is Consistent Hashing and Why is it Used?
mediumDistributed Systems 5 mins206. What is a Count-Min Sketch and When Would You Use One?
hardProbabilistic Data Structures 6 mins207. Skip List vs Balanced Tree: When Would You Use Each?
hardData Structures 6 mins208. What is Heavy-Light Decomposition?
hardTrees 6 mins209. What is the Sparse Table Technique?
mediumRange Queries 5 mins210. What is Mo's Algorithm?
hardRange Queries 6 mins211. What are Persistent Data Structures?
hardAdvanced Data Structures 6 mins212. What is a Disjoint Sparse Table?
hardRange Queries 6 mins213. Knuth-Morris-Pratt vs Rabin-Karp: What is the Difference?
hardString Algorithms 6 mins214. What is the Aho-Corasick Algorithm?
hardString Algorithms 6 mins215. What is a Suffix Automaton?
hardString Algorithms 6 mins216. How Do You Solve the Longest Repeated Substring Problem?
hardString Algorithms 6 mins217. What is String Hashing and How Is It Used?
mediumString Algorithms 5 mins218. Array of Arrays vs a True 2D Array: What is the Difference?
mediumArrays 5 mins219. Static Arrays vs Dynamic Arrays: What is the Difference?
easyArrays 5 mins220. What is a Circular Buffer (Ring Buffer)?
mediumData Structures 5 mins221. How Would You Represent a Sparse Matrix Efficiently?
mediumData Structures 6 mins222. Adjacency List vs Adjacency Matrix: When Would You Use Each?
mediumGraph Algorithms 6 mins223. What Are the Main Graph Representation Techniques?
mediumGraph Algorithms 5 mins224. Weighted vs Unweighted Graphs: What is the Difference?
easyGraph Algorithms 5 mins225. Directed vs Undirected Graphs: What is the Difference?
easyGraph Algorithms 5 mins226. In-Place vs Out-of-Place Algorithms: What is the Difference?
mediumAlgorithm Design 5 mins227. Online vs Offline Algorithms: What is the Difference?
mediumAlgorithm Design 6 mins