Top 100 Data Structure and Algorithms DSA Interview Questions Topic-wise
DSA has been one of the most popular go-to topics for any interview, be it college placements, software developer roles, or any other technical roles for freshers and experienced to land a decent job. If you are among them, you already know that it is not easy to find the best DSA interview questions among the vast pool of available problems. So here we are, with the Top 100 most asked DSA interview questions to help you sail through your technical rounds.
For a quick and focused revision, check out our GfG-160
Master Complete DSA from basic to advanced with DSA-360°
Array
- Pair with the given Sum
- Best Time to Buy and Sell Stock
- Product of Array Except Self
- Maximum Subarray
- Container With Most Water
- Factorial of a large number
- Trapping Rain Water
- Insert and Merge Intervals
- Merge Intervals
For more, please refer Top 50 Array Interview Questions
Matrix
For more, please refer Top 50 Matrix Interview Questions
String
- Longest Substring Without Repeating
- Longest Repeating Character Replacement
- Smallest window containing all characters
- Print all anagrams together
- Sentence Palindrome
- Longest Palindromic Substring
- Palindromic Substrings
For more, please refer Top 50 String Interview Questions
Searching and Sorting
- Search in Rotated Sorted Array
- Peak Element
- K-th element of two sorted arrays
- Allocate Minimum Pages
- Kth Missing Positive Number
- Sort 0s, 1s and 2s
- Count Inversions
- Merge two sorted arrays without extra space
- Chocolate Distribution Problem
Hashing
- Print all pairs with given sum
- Longest Subsequence with Adjacent Difference of 0 or 1
- Longest Consecutive Sequence
- Count Subarrays with given XOR
Linked List
- Reverse a Linked List
- Detect Cycle in a Linked List
- Merge Two Sorted Lists
- Merge K Sorted Lists
- Remove Nth Node From End Of List
- Reorder List
- Add 1 to a number represented as linked list
- Clone a Linked List
For more, please refer Top 50 Linked List Interview Questions
Stack, Queue & Deque
- Infix to Postfix expression
- Next Greater Element
- Largest Area in a Histogram
- Delete middle element of a stack
- Length of the longest valid substring
- Sum of Max of Subarrays
- Next Greater Element in a Circular Array
- Longest Bounded-Difference Subarray
- K Sized Subarray Maximum
For more, please refer Stack Interview Questions, Queue Interview Questions, and Deque Interview Questions
Tree
- Maximum Depth of Binary Tree
- Check for Mirror Trees
- Invert/Flip Binary Tree
- Binary Tree Maximum Path Sum
- Binary Tree Level Order Traversal
- Serialize and Deserialize Binary Tree
- Subtree of Another Tree
- Construct Binary Tree from Preorder and Inorder Traversal
- Validate Binary Search Tree
- Kth Smallest Element in a BST
- Lowest Common Ancestor of BST
- Implement Trie (Prefix Tree)
For more, please refer Top 50 Tree Interview Questions
Heap
- Top K Frequent Elements
- Find Median from Data Stream
- Largest triplet product in a stream
- Connect n Ropes
For more, please refer Top 50 Heap Interview Questions
Graph
- Clone Graph
- Course Schedule
- Pacific Atlantic Water Flow
- Number of Islands
- Snake and Ladder Problem
- Detect Cycle in a Directed Graph
- Bridges in a Graph
- Check for Bipartite
- Largest region in Boolean Matrix
- Flood fill Algorithm
- Strongly Connected Components
- Topological Sorting
For more, please refer Top 50 Graph Interview Questions
Dynamic Programming & Greedy
- Count ways to reach the n’th stair
- Coin Change
- 0/1 Knapsack Problem
- Longest Increasing Subsequence
- Longest Common Subsequence
- Word Break Problem
- Dice Throw
- Egg Dropping Puzzle
- Matrix Chain Multiplication
- Combination Sum
- Subset Sum Problem
- Maximum possible stolen value
- Count Possible Decodings of a given Digit Sequence
- Unique paths in a Grid with Obstacles
- Jump Game
- Cutting a Rod
- Maximum Product Cutting
- Count number of ways to cover a distance
- Connect n ropes with minimum cost
- Largest Number in one Swap
For more, please refer Top DP Interview Questions & Top Greedy Interview Questions
Bit Manipulations
For more, please refer Top Bit Manipulation Interview Questions