[go: up one dir, main page]

0% found this document useful (0 votes)
48 views12 pages

150+ DSA Interview Questions

The document lists over 150 data structures and algorithms (DSA) interview questions categorized into topics such as Arrays, Strings, Linked Lists, Stacks & Queues, Trees & BST, Heaps, Graphs, Dynamic Programming, Recursion & Backtracking, Bit Manipulation, Greedy Algorithms, and Math & Miscellaneous. Each category includes specific questions designed to test knowledge and skills in those areas. This comprehensive resource serves as a study guide for individuals preparing for technical interviews.

Uploaded by

jaishreeram3212
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)
48 views12 pages

150+ DSA Interview Questions

The document lists over 150 data structures and algorithms (DSA) interview questions categorized into topics such as Arrays, Strings, Linked Lists, Stacks & Queues, Trees & BST, Heaps, Graphs, Dynamic Programming, Recursion & Backtracking, Bit Manipulation, Greedy Algorithms, and Math & Miscellaneous. Each category includes specific questions designed to test knowledge and skills in those areas. This comprehensive resource serves as a study guide for individuals preparing for technical interviews.

Uploaded by

jaishreeram3212
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/ 12

150+ DSA Interview Questions

150+ DSA interview questions


Topics

● Arrays

● Strings

● Linked Lists

● Stacks & Queues

● Trees & BST

● Heaps

● Graphs

● Dynamic Programming

● Recursion & Backtracking

● Bit Manipulation

● Greedy Algorithms

● Math & Misc

https://docs.google.com/document/d/1HawPiMsx-iHdlbrgDIHu-1Yplj6WrxLYaDXOSslgNqw/mobilebasic 30/04/25, 10 21 AM
Page 1 of 12
:
Arrays

1. Find the missing number in an array.

2. Find the largest and smallest element in an array.

3. Kadane’s Algorithm for Maximum Subarray Sum.

4. Move all zeros to the end of the array.

5. Find the duplicate number in an array.

6. Merge two sorted arrays.

7. Find the intersection of two arrays.

8. Cyclically rotate an array by one.

9. Find the majority element in an array.

10. Best time to buy and sell stock.

11. Rearrange array in alternating positive & negative items.

12. Find subarray with given sum.

13. Check if a subarray with 0 sum exists.

14. Find the longest consecutive sequence.

15. Two sum problem.

16. Find the median of two sorted arrays.

17. Find the kth largest element in an array.

https://docs.google.com/document/d/1HawPiMsx-iHdlbrgDIHu-1Yplj6WrxLYaDXOSslgNqw/mobilebasic 30/04/25, 10 21 AM
Page 2 of 12
:
18. Product of array except self.

19. Rotate array by k steps.

20. Find all pairs with a given sum.

Strings

21. Reverse a string.

22. Check if a string is a palindrome.

23. Find the first non-repeating character in a string.

24. Longest substring without repeating characters.

25. Check if two strings are anagrams.

26. Implement strStr() (substring search).

27. Count and say problem.

28. Longest Palindromic Substring.

29. Zigzag Conversion.

30. String to Integer (atoi).

31. Group anagrams.

32. Multiply two large numbers represented as strings.

33. Roman to Integer.

https://docs.google.com/document/d/1HawPiMsx-iHdlbrgDIHu-1Yplj6WrxLYaDXOSslgNqw/mobilebasic 30/04/25, 10 21 AM
Page 3 of 12
:
34. Integer to Roman.

35. Valid Parentheses.

36. Implement Regular Expression Matching.

37. Wildcard Matching.

38. Minimum window substring.

39. Repeated substring pattern.

40. Longest common prefix.

Linked Lists

41. Reverse a linked list.

42. Detect a cycle in a linked list.

43. Find the middle of a linked list.

44. Merge two sorted linked lists.

45. Remove nth node from end of list.

46. Add two numbers represented by linked lists.

47. Check if linked list is palindrome.

48. Intersection point of two linked lists.

https://docs.google.com/document/d/1HawPiMsx-iHdlbrgDIHu-1Yplj6WrxLYaDXOSslgNqw/mobilebasic 30/04/25, 10 21 AM
Page 4 of 12
:
49. Flatten a linked list.

50. Copy a linked list with random pointers.

51. Rotate linked list.

52. Sort a linked list.

53. Remove duplicates from sorted linked list.

54. Delete a node without head pointer.

55. Swap nodes in pairs.

Stacks & Queues

56. Implement a stack using arrays/linked list.

57. Implement a queue using stacks.

58. Valid Parentheses using stack.

59. Min Stack implementation.

60. Evaluate Reverse Polish Notation.

61. Implement LRU Cache.

62. Largest rectangle in histogram.

63. Sliding window maximum.

64. Design a circular queue.

https://docs.google.com/document/d/1HawPiMsx-iHdlbrgDIHu-1Yplj6WrxLYaDXOSslgNqw/mobilebasic 30/04/25, 10 21 AM
Page 5 of 12
:
65. Next greater element.

Trees & BST

66. Inorder, Preorder, Postorder traversal of binary tree.

67. Level order traversal.

68. Check if two trees are identical.

69. Height of a binary tree.

70. Diameter of a binary tree.

71. Lowest Common Ancestor in Binary Tree.

72. Check if a tree is a BST.

73. Convert sorted array to BST.

74. Serialize and Deserialize Binary Tree.

75. Zigzag Level Order Traversal.

76. Right view of Binary Tree.

77. Left view of Binary Tree.

78. Find kth smallest element in BST.

79. Recover BST where two nodes are swapped.

https://docs.google.com/document/d/1HawPiMsx-iHdlbrgDIHu-1Yplj6WrxLYaDXOSslgNqw/mobilebasic 30/04/25, 10 21 AM
Page 6 of 12
:
80. Maximum path sum in Binary Tree.

Heaps

81. Implement a Min Heap / Max Heap.

82. Find kth largest element in a stream.

83. Merge k sorted lists.

84. Find median from data stream.

85. Sliding window maximum using heap.

86. Top K frequent elements.

Graphs

87. Implement BFS.

88. Implement DFS.

89. Detect cycle in an undirected graph.

90. Detect cycle in a directed graph.

91. Number of islands.

92. Clone a graph.

https://docs.google.com/document/d/1HawPiMsx-iHdlbrgDIHu-1Yplj6WrxLYaDXOSslgNqw/mobilebasic 30/04/25, 10 21 AM
Page 7 of 12
:
93. Topological sort.

94. Shortest path in unweighted graph.

95. Dijkstra’s Algorithm.

96. Find connected components in graph.

97. Course schedule problem.

98. Minimum Spanning Tree (Prim’s/Kruskal’s).

99. Word Ladder problem.

100. Graph coloring problem.

101. Bellman-Ford Algorithm.

Dynamic Programming

102. Fibonacci Number using DP.

103. Longest Increasing Subsequence.

104. 0/1 Knapsack Problem.

105. Coin Change Problem.

106. Longest Common Subsequence.

107. Edit Distance.

108. Maximum Subarray Sum.

https://docs.google.com/document/d/1HawPiMsx-iHdlbrgDIHu-1Yplj6WrxLYaDXOSslgNqw/mobilebasic 30/04/25, 10 21 AM
Page 8 of 12
:
109. Subset Sum Problem.

110. Partition Equal Subset Sum.

111. Word Break Problem.

112. Unique Paths in a Grid.

113. Minimum Path Sum.

114. Jump Game.

115. House Robber Problem.

116. Palindrome Partitioning.

Recursion & Backtracking

117. Generate all subsets of a set.

118. Permutations of a string/array.

119. N-Queens Problem.

120. Sudoku Solver.

121. Word Search Problem.

122. Rat in a Maze Problem.

123. Generate Parentheses.

124. Combination Sum.

https://docs.google.com/document/d/1HawPiMsx-iHdlbrgDIHu-1Yplj6WrxLYaDXOSslgNqw/mobilebasic 30/04/25, 10 21 AM
Page 9 of 12
:
125. Letter Combinations of a Phone Number.

126. Restore IP Addresses.

Bit Manipulation

127. Find the single number in array where every element appears twice except one.

128. Count total set bits in a number.

129. Find XOR of numbers from 1 to n.

130. Check if a number is power of two.

131. Divide two integers without using division.

132. Find missing number using XOR.

133. Sum of two integers without using ‘+’ operator.

134. Number of 1 bits.

135. Reverse bits of a number.

136. Detect if two integers have opposite signs.

Greedy Algorithms

137. Activity Selection Problem.

https://docs.google.com/document/d/1HawPiMsx-iHdlbrgDIHu-1Yplj6WrxLYaDXOSslgNqw/mobilebasic 30/04/25, 10 21 AM
Page 10 of 12
:
138. Fractional Knapsack Problem.

139. Minimum number of platforms required for a railway.

140. Huffman Encoding.

141. Job Sequencing Problem.

142. Gas Station Problem.

143. Jump Game II.

144. Candy Distribution Problem.

145. Assign Cookies Problem.

146. Minimum number of coins for change.

Math & Miscellaneous

147. Check if a number is prime.

148. Greatest Common Divisor (GCD) of two numbers.

149. Sieve of Eratosthenes.

150. Find sqrt of a number.

151. Count trailing zeros in factorial.

152. Excel Sheet Column Number conversion.

153. Happy Number Problem.

https://docs.google.com/document/d/1HawPiMsx-iHdlbrgDIHu-1Yplj6WrxLYaDXOSslgNqw/mobilebasic 30/04/25, 10 21 AM
Page 11 of 12
:
154. Power of Three/Four.

155. Spiral Matrix traversal.

156. Pascal’s Triangle generation.

https://docs.google.com/document/d/1HawPiMsx-iHdlbrgDIHu-1Yplj6WrxLYaDXOSslgNqw/mobilebasic 30/04/25, 10 21 AM
Page 12 of 12
:

You might also like