0% found this document useful (0 votes)
28 views69 pages

150 Most Asked DSA Interview Q&A

Uploaded by

shivadatta2004
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views69 pages

150 Most Asked DSA Interview Q&A

Uploaded by

shivadatta2004
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 69

Top 150

DSA Interview Questions

1 3

1 14 19

3 25 42

40
*Disclaimer*
Interviews test problem-solving, not memory.

Your ability to analyze, reason, and optimize


matters more than rote learning.

This doc is a step towards building that


mindset.
Array/String

1. Merge Sorted Array (Easy)

Practice

2. Remove Element (Easy)

Practice
3. Remove Duplicates from Sorted Array (Easy)

Practice

4. Remove Duplicates from Sorted Array II (Medium)

Practice
5. Majority Element (Easy)

Practice

6. Rotate Array (Medium)

Practice

7. Best Time to Buy and Sell Stock (Easy)

Practice
8. Best Time to Buy and Sell Stock II (Medium)

Practice

9. Jump Game (Medium)

Practice

10. Jump Game II (Medium)


Practice

11. H-Index (Medium)

Practice

12. Insert Delete GetRandom O(1) (Medium)

Practice
13. Product of Array Except Self (Medium)

Practice

14. Gas Station (Medium)

Practice

15. Candy (Hard)


Practice

16. Trapping Rain Water (Hard)

Practice

17. Roman to Integer (Easy)

(in a table here )


Practice

18. Integer to Roman (Medium)

Practice

19. Length of Last Word (Easy)

Practice
20. Longest Common Prefix (Easy)

Practice

21. Reverse Words in a String (Medium)

Practice

22. Zigzag Conversion (Medium)

Practice

23. Find the Index of the First Occurrence in a String (Easy)


Practice

24. Text Justification (Hard)


Practice
Two Pointers

25. Valid Palindrome (Easy)

Practice

26. Is Subsequence (Easy)

Practice

27. Two Sum II - Input Array Is Sorted (Medium)


Practice

28. Container With Most Water (Medium)

Practice

29. 3Sum (Medium)

Practice
Sliding Window
30. Minimum Size Subarray Sum (Medium)

Practice
31. Longest Substring Without Repeating Characters
(Medium)

Practice
32. Substring with Concatenation of All Words (Hard)
Practice

33. Minimum Window Substring (Hard)

Practice
Matrix

34. Valid Sudoku (Medium)

Practice

35. Spiral Matrix (Medium)

Practice

36. Rotate Image (Medium)


Practice

37. Set Matrix Zeroes (Medium)

Practice

38. Game of Life (Medium)


Practice
Hashmap

39. Ransom Note (Easy)

Practice

40. Isomorphic Strings (Easy)

Practice

41. Word Pattern (Easy)


Practice

42. Valid Anagram (Easy)

Practice

43. Group Anagrams (Medium)

Practice

44. Two Sum (Easy)

Practice
45. Happy Number (Easy)

Practice

46. Contains Duplicate II (Easy)

Practice

47. Longest Consecutive Sequence (Medium)

Practice
Intervals

48. Summary Ranges (Easy)

Practice

49. Merge Intervals (Medium)

Practice
50. Insert Interval (Medium)

Practice

51. Minimum Number of Arrows to Burst Balloons

(Medium)
Practice
Stack

52. Valid Parentheses (Easy)

Practice

53. Simplify Path (Medium)


Practice

54. Min Stack (Medium)

Practice

55. Evaluate Reverse Polish Notation (Medium)


Practice

56. Basic Calculator (Hard)

Practice
Linked List

57. Linked List Cycle (Easy)

Practice

58. Add Two Numbers (Medium)

Practice

59. Merge Two Sorted Lists (Easy)


Practice

60. Copy List with Random Pointer (Medium)

Practice

61. Reverse Linked List II (Medium)

Practice
62. Reverse Nodes in k-Group (Hard)

Practice

63. Remove Nth Node From End of List (Medium)

Practice

64. Remove Duplicates from Sorted List II (Medium)

Practice

65. Rotate List (Medium)

Practice
66. Partition List (Medium)

Practice

67. LRU Cache (Medium)

Practice
Binary Tree General
68. Maximum Depth of Binary Tree (Easy)

Practice

69. Same Tree (Easy)

Practice

70. Invert Binary Tree (Easy)

Practice

71. Symmetric Tree (Easy)


Practice

72. Construct Binary Tree from Preorder and Inorder

Traversal (Medium)

Practice

73. Construct Binary Tree from Inorder and Postorder

Traversal (Medium)

Practice

74. Populating Next Right Pointers in Each Node II

(Medium)
Practice

75. Flatten Binary Tree to Linked List (Medium)

Practice

76. Path Sum (Easy)

Practice

77. Sum Root to Leaf Numbers (Medium)


Practice

78. Binary Tree Maximum Path Sum (Hard)

Practice

79. Binary Search Tree Iterator (Medium)


Practice

80. Count Complete Tree Nodes (Easy)

Practice

81. Lowest Common Ancestor of a Binary Tree (Medium)

Practice
Binary Tree BFS

82. Binary Tree Right Side View (Medium)

Practice

83. Average of Levels in Binary Tree (Easy)

Practice

84. Binary Tree Level Order Traversal (Medium)

Practice

85. Binary Tree Zigzag Level Order Traversal (Medium)

Practice
Binary Tree BFS

86. Minimum Absolute Difference in BST (Easy)

Practice

87. Kth Smallest Element in a BST (Medium)

Practice

88. Validate Binary Search Tree (Medium)

Practice
Graph General

89. Number of Islands (Medium)

Practice

90. Surrounded Regions (Medium)

Practice

91. Clone Graph (Medium)


Practice

92. Evaluate Division (Medium)

Practice
93. Course Schedule (Medium)

Practice

94. Course Schedule II (Medium)

Practice
Graph BFS

95. Snakes and Ladders (Medium)

Practice

96. Minimum Genetic Mutation (Medium)

Practice
97. Word Ladder (Hard)

Practice
Trie

98. Implement Trie (Prefix Tree) (Medium)

Practice

99. Design Add and Search Words Data Structure


(Medium)

Practice

100. Word Search II (Hard)

Practice
Backtracking

101. Letter Combinations of a Phone Number (Medium)

Practice

102. Combinations (Medium)

Practice

103. Permutations (Medium)

Practice
104. Combination Sum (Medium)

Practice

105. N-Queens II (Hard)

Practice

106. Generate Parentheses (Medium)

Practice
107. Word Search (Medium)

Practice
Divide & Conquer

108. Convert Sorted Array to Binary Search Tree (Easy)

Practice

109. Sort List (Medium)

Practice

110. Construct Quad Tree (Medium)

Practice
111. Merge k Sorted Lists (Hard)

Practice
Kadane's Algorithm

112. Maximum Subarray (Medium)

Practice

113. Maximum Sum Circular Subarray (Medium)

Practice
Binary Search

114. Search Insert Position (Easy)

Practice

115. Search a 2D Matrix (Medium)

Practice

116. Find Peak Element (Medium)


Practice

117. Search in Rotated Sorted Array (Medium)

Practice

118. Find First and Last Position of Element in Sorted Array

(Medium)

Practice
119. Find Minimum in Rotated Sorted Array (Medium)

Practice

120. Median of Two Sorted Arrays (Hard)

Practice
Heap

121. Kth Largest Element in an Array (Medium)

Practice

122. IPO (Hard)

Practice
123. Find K Pairs with Smallest Sums (Medium)

Practice

124. Find Median from Data Stream (Hard)

Practice
Bit Manipulation

125. Add Binary (Easy)

Practice

126. Reverse Bits (Easy)

Practice

127. Number of 1 Bits (Easy)

Practice

128. Single Number (Easy)

Practice
129. Single Number II (Medium)

Practice

130. Bitwise AND of Numbers Range (Medium)

Practice
Math

131. Palindrome Number (Easy)

Practice

132. Plus One (Easy)

Practice

133. Factorial Trailing Zeroes (Medium)

Practice

134. Sqrt(x) (Easy)


Practice

135. Pow(x, n) (Medium)

Practice

136. Max Points on a Line (Hard)

Practice
1D DP

137. Climbing Stairs (Easy)

Practice

138. House Robber (Medium)

Practice

139. Word Break (Medium)


Practice

140. Coin Change (Medium)

Practice

141. Longest Increasing Subsequence (Medium)

Practice
Multidimensional DP

142. Triangle (Medium)

Practice

143. Minimum Path Sum (Medium)

Practice

144. Unique Paths II (Medium)


Practice

145. Longest Palindromic Substring (Medium)

Practice

146. Interleaving String (Medium)

Practice

147. Edit Distance (Medium)


Practice

148. Best Time to Buy and Sell Stock III (Hard)

Practice

149. Best Time to Buy and Sell Stock IV (Hard)

Practice
150. Maximal Square (Medium)

Practice
Explore More

You might also like