Stack DSA Problems

167 stack problems for coding interviews and campus placements, with hints and company tags. Below are the first 100 of 167: 23 easy, 31 medium and 46 hard. Practise them free on InternHack and track what you have solved.

Stack problems, easiest first

  1. Backspace String Compare (Easy)
  2. Baseball Game (Easy)
  3. Binary Tree Inorder Traversal (Easy)
  4. Binary Tree Postorder Traversal (Easy)
  5. Binary Tree Preorder Traversal (Easy)
  6. Clear Digits (Easy)
  7. Crawler Log Folder (Easy)
  8. Final Prices With a Special Discount in a Shop (Easy)
  9. Implement Queue using Stacks (Easy)
  10. Implement Stack using Queues (Easy)
  11. Increasing Order Search Tree (Easy)
  12. Make The String Great (Easy)
  13. Maximum Nesting Depth of the Parentheses (Easy)
  14. Minimum String Length After Removing Substrings (Easy)
  15. N-ary Tree Postorder Traversal (Easy)
  16. N-ary Tree Preorder Traversal (Easy)
  17. Next Greater Element I (Easy)
  18. Number of Students Unable to Eat Lunch (Easy)
  19. Palindrome Linked List (Easy)
  20. Remove All Adjacent Duplicates In String (Easy)
  21. Remove Outermost Parentheses (Easy)
  22. Reverse Prefix of Word (Easy)
  23. Valid Parentheses (Easy)
  24. 132 Pattern (Medium)
  25. Add Two Numbers II (Medium)
  26. Asteroid Collision (Medium)
  27. Basic Calculator II (Medium)
  28. Beautiful Towers I (Medium)
  29. Beautiful Towers II (Medium)
  30. Binary Search Tree Iterator (Medium)
  31. Binary Search Tree Iterator II (Medium)
  32. Binary Searchable Numbers in an Unsorted Array (Medium)
  33. Brace Expansion (Medium)
  34. Build an Array With Stack Operations (Medium)
  35. Buildings With an Ocean View (Medium)
  36. Car Fleet (Medium)
  37. Check if a Parentheses String Can Be Valid (Medium)
  38. Check If Word Is Valid After Substitutions (Medium)
  39. Clumsy Factorial (Medium)
  40. Construct Binary Search Tree from Preorder Traversal (Medium)
  41. Construct Binary Tree from String (Medium)
  42. Construct Smallest Number From DI String (Medium)
  43. Convert Binary Search Tree to Sorted Doubly Linked List (Medium)
  44. Count Bowl Subarrays (Medium)
  45. Count Collisions on a Road (Medium)
  46. Count Submatrices With All Ones (Medium)
  47. Daily Temperatures (Medium)
  48. Decode String (Medium)
  49. Decoded String at Index (Medium)
  50. Design a Stack With Increment Operation (Medium)
  51. Design an Expression Tree With Evaluate Function (Medium)
  52. Design Browser History (Medium)
  53. Double a Number Represented as a Linked List (Medium)
  54. Evaluate Reverse Polish Notation (Medium)
  55. Apply Operations to Maximize Score (Hard)
  56. Basic Calculator (Hard)
  57. Basic Calculator III (Hard)
  58. Basic Calculator IV (Hard)
  59. Brace Expansion II (Hard)
  60. Build Binary Expression Tree From Infix Expression (Hard)
  61. Car Fleet II (Hard)
  62. Closest Binary Search Tree Value II (Hard)
  63. Count Non-Decreasing Subarrays After K Operations (Hard)
  64. Create Maximum Number (Hard)
  65. Design a Text Editor (Hard)
  66. Dinner Plate Stacks (Hard)
  67. Find Building Where Alice and Bob Can Meet (Hard)
  68. Find Maximum Non-decreasing Array Length (Hard)
  69. Find the Number of Subarrays Where Boundary Elements Are Maximum (Hard)
  70. Largest Rectangle in Histogram (Hard)
  71. Lexicographically Smallest String After Deleting Duplicate Characters (Hard)
  72. Longest Valid Parentheses (Hard)
  73. Max Chunks To Make Sorted II (Hard)
  74. Max Stack (Hard)
  75. Maximal Rectangle (Hard)
  76. Maximum Frequency Score of a Subarray (Hard)
  77. Maximum Frequency Stack (Hard)
  78. Maximum Number of Books You Can Take (Hard)
  79. Maximum Score of a Good Subarray (Hard)
  80. Minimum Cost to Change the Final Value of Expression (Hard)
  81. Minimum Number of Increments on Subarrays to Form a Target Array (Hard)
  82. Minimum Number of Visited Cells in a Grid (Hard)
  83. Minimum Operations to Make Array Equal to Target (Hard)
  84. Minimum Time to Complete All Tasks (Hard)
  85. Number of Atoms (Hard)
  86. Number of Valid Subarrays (Hard)
  87. Number of Visible People in a Queue (Hard)
  88. Odd Even Jump (Hard)
  89. Parse Lisp Expression (Hard)
  90. Parsing A Boolean Expression (Hard)
  91. Replace Non-Coprime Numbers in Array (Hard)
  92. Robot Collisions (Hard)
  93. Smallest K-Length Subsequence With Occurrences of a Letter (Hard)
  94. Stamping The Sequence (Hard)
  95. Subarray With Elements Greater Than Varying Threshold (Hard)
  96. Sum of Total Strength of Wizards (Hard)
  97. Tag Validator (Hard)
  98. The Score of Students Solving Math Expression (Hard)
  99. Trapping Rain Water (Hard)
  100. Zuma Game (Hard)

Companies that ask stack problems

Before your interview

Most resumes are filtered by software before a recruiter reads them. Check your resume ATS score free, no signup needed.

Other DSA topics