# Stack DSA Problems

> 167 Stack coding problems for placements and interviews, sorted easiest first, with hints and company tags. Free practice on InternHack.

Canonical: https://www.internhack.in/learn/dsa/stack
Last updated: 2026-11-28

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](https://www.internhack.in/learn/dsa/problem/backspace-string-compare) (Easy)
2. [Baseball Game](https://www.internhack.in/learn/dsa/problem/baseball-game) (Easy)
3. [Binary Tree Inorder Traversal](https://www.internhack.in/learn/dsa/problem/binary-tree-inorder-traversal) (Easy)
4. [Binary Tree Postorder Traversal](https://www.internhack.in/learn/dsa/problem/binary-tree-postorder-traversal) (Easy)
5. [Binary Tree Preorder Traversal](https://www.internhack.in/learn/dsa/problem/binary-tree-preorder-traversal) (Easy)
6. [Clear Digits](https://www.internhack.in/learn/dsa/problem/clear-digits) (Easy)
7. [Crawler Log Folder](https://www.internhack.in/learn/dsa/problem/crawler-log-folder) (Easy)
8. [Final Prices With a Special Discount in a Shop](https://www.internhack.in/learn/dsa/problem/final-prices-with-a-special-discount-in-a-shop) (Easy)
9. [Implement Queue using Stacks](https://www.internhack.in/learn/dsa/problem/implement-queue-using-stacks) (Easy)
10. [Implement Stack using Queues](https://www.internhack.in/learn/dsa/problem/implement-stack-using-queues) (Easy)
11. [Increasing Order Search Tree](https://www.internhack.in/learn/dsa/problem/increasing-order-search-tree) (Easy)
12. [Make The String Great](https://www.internhack.in/learn/dsa/problem/make-the-string-great) (Easy)
13. [Maximum Nesting Depth of the Parentheses](https://www.internhack.in/learn/dsa/problem/maximum-nesting-depth-of-the-parentheses) (Easy)
14. [Minimum String Length After Removing Substrings](https://www.internhack.in/learn/dsa/problem/minimum-string-length-after-removing-substrings) (Easy)
15. [N-ary Tree Postorder Traversal](https://www.internhack.in/learn/dsa/problem/n-ary-tree-postorder-traversal) (Easy)
16. [N-ary Tree Preorder Traversal](https://www.internhack.in/learn/dsa/problem/n-ary-tree-preorder-traversal) (Easy)
17. [Next Greater Element I](https://www.internhack.in/learn/dsa/problem/next-greater-element-i) (Easy)
18. [Number of Students Unable to Eat Lunch](https://www.internhack.in/learn/dsa/problem/number-of-students-unable-to-eat-lunch) (Easy)
19. [Palindrome Linked List](https://www.internhack.in/learn/dsa/problem/palindrome-linked-list) (Easy)
20. [Remove All Adjacent Duplicates In String](https://www.internhack.in/learn/dsa/problem/remove-all-adjacent-duplicates-in-string) (Easy)
21. [Remove Outermost Parentheses](https://www.internhack.in/learn/dsa/problem/remove-outermost-parentheses) (Easy)
22. [Reverse Prefix of Word](https://www.internhack.in/learn/dsa/problem/reverse-prefix-of-word) (Easy)
23. [Valid Parentheses](https://www.internhack.in/learn/dsa/problem/valid-parentheses) (Easy)
24. [132 Pattern](https://www.internhack.in/learn/dsa/problem/132-pattern) (Medium)
25. [Add Two Numbers II](https://www.internhack.in/learn/dsa/problem/add-two-numbers-ii) (Medium)
26. [Asteroid Collision](https://www.internhack.in/learn/dsa/problem/asteroid-collision) (Medium)
27. [Basic Calculator II](https://www.internhack.in/learn/dsa/problem/basic-calculator-ii) (Medium)
28. [Beautiful Towers I](https://www.internhack.in/learn/dsa/problem/beautiful-towers-i) (Medium)
29. [Beautiful Towers II](https://www.internhack.in/learn/dsa/problem/beautiful-towers-ii) (Medium)
30. [Binary Search Tree Iterator](https://www.internhack.in/learn/dsa/problem/binary-search-tree-iterator) (Medium)
31. [Binary Search Tree Iterator II](https://www.internhack.in/learn/dsa/problem/binary-search-tree-iterator-ii) (Medium)
32. [Binary Searchable Numbers in an Unsorted Array](https://www.internhack.in/learn/dsa/problem/binary-searchable-numbers-in-an-unsorted-array) (Medium)
33. [Brace Expansion](https://www.internhack.in/learn/dsa/problem/brace-expansion) (Medium)
34. [Build an Array With Stack Operations](https://www.internhack.in/learn/dsa/problem/build-an-array-with-stack-operations) (Medium)
35. [Buildings With an Ocean View](https://www.internhack.in/learn/dsa/problem/buildings-with-an-ocean-view) (Medium)
36. [Car Fleet](https://www.internhack.in/learn/dsa/problem/car-fleet) (Medium)
37. [Check if a Parentheses String Can Be Valid](https://www.internhack.in/learn/dsa/problem/check-if-a-parentheses-string-can-be-valid) (Medium)
38. [Check If Word Is Valid After Substitutions](https://www.internhack.in/learn/dsa/problem/check-if-word-is-valid-after-substitutions) (Medium)
39. [Clumsy Factorial](https://www.internhack.in/learn/dsa/problem/clumsy-factorial) (Medium)
40. [Construct Binary Search Tree from Preorder Traversal](https://www.internhack.in/learn/dsa/problem/construct-binary-search-tree-from-preorder-traversal) (Medium)
41. [Construct Binary Tree from String](https://www.internhack.in/learn/dsa/problem/construct-binary-tree-from-string) (Medium)
42. [Construct Smallest Number From DI String](https://www.internhack.in/learn/dsa/problem/construct-smallest-number-from-di-string) (Medium)
43. [Convert Binary Search Tree to Sorted Doubly Linked List](https://www.internhack.in/learn/dsa/problem/convert-binary-search-tree-to-sorted-doubly-linked-list) (Medium)
44. [Count Bowl Subarrays](https://www.internhack.in/learn/dsa/problem/count-bowl-subarrays) (Medium)
45. [Count Collisions on a Road](https://www.internhack.in/learn/dsa/problem/count-collisions-on-a-road) (Medium)
46. [Count Submatrices With All Ones](https://www.internhack.in/learn/dsa/problem/count-submatrices-with-all-ones) (Medium)
47. [Daily Temperatures](https://www.internhack.in/learn/dsa/problem/daily-temperatures) (Medium)
48. [Decode String](https://www.internhack.in/learn/dsa/problem/decode-string) (Medium)
49. [Decoded String at Index](https://www.internhack.in/learn/dsa/problem/decoded-string-at-index) (Medium)
50. [Design a Stack With Increment Operation](https://www.internhack.in/learn/dsa/problem/design-a-stack-with-increment-operation) (Medium)
51. [Design an Expression Tree With Evaluate Function](https://www.internhack.in/learn/dsa/problem/design-an-expression-tree-with-evaluate-function) (Medium)
52. [Design Browser History](https://www.internhack.in/learn/dsa/problem/design-browser-history) (Medium)
53. [Double a Number Represented as a Linked List](https://www.internhack.in/learn/dsa/problem/double-a-number-represented-as-a-linked-list) (Medium)
54. [Evaluate Reverse Polish Notation](https://www.internhack.in/learn/dsa/problem/evaluate-reverse-polish-notation) (Medium)
55. [Apply Operations to Maximize Score](https://www.internhack.in/learn/dsa/problem/apply-operations-to-maximize-score) (Hard)
56. [Basic Calculator](https://www.internhack.in/learn/dsa/problem/basic-calculator) (Hard)
57. [Basic Calculator III](https://www.internhack.in/learn/dsa/problem/basic-calculator-iii) (Hard)
58. [Basic Calculator IV](https://www.internhack.in/learn/dsa/problem/basic-calculator-iv) (Hard)
59. [Brace Expansion II](https://www.internhack.in/learn/dsa/problem/brace-expansion-ii) (Hard)
60. [Build Binary Expression Tree From Infix Expression](https://www.internhack.in/learn/dsa/problem/build-binary-expression-tree-from-infix-expression) (Hard)
61. [Car Fleet II](https://www.internhack.in/learn/dsa/problem/car-fleet-ii) (Hard)
62. [Closest Binary Search Tree Value II](https://www.internhack.in/learn/dsa/problem/closest-binary-search-tree-value-ii) (Hard)
63. [Count Non-Decreasing Subarrays After K Operations](https://www.internhack.in/learn/dsa/problem/count-non-decreasing-subarrays-after-k-operations) (Hard)
64. [Create Maximum Number](https://www.internhack.in/learn/dsa/problem/create-maximum-number) (Hard)
65. [Design a Text Editor](https://www.internhack.in/learn/dsa/problem/design-a-text-editor) (Hard)
66. [Dinner Plate Stacks](https://www.internhack.in/learn/dsa/problem/dinner-plate-stacks) (Hard)
67. [Find Building Where Alice and Bob Can Meet](https://www.internhack.in/learn/dsa/problem/find-building-where-alice-and-bob-can-meet) (Hard)
68. [Find Maximum Non-decreasing Array Length](https://www.internhack.in/learn/dsa/problem/find-maximum-non-decreasing-array-length) (Hard)
69. [Find the Number of Subarrays Where Boundary Elements Are Maximum](https://www.internhack.in/learn/dsa/problem/find-the-number-of-subarrays-where-boundary-elements-are-maximum) (Hard)
70. [Largest Rectangle in Histogram](https://www.internhack.in/learn/dsa/problem/largest-rectangle-in-histogram) (Hard)
71. [Lexicographically Smallest String After Deleting Duplicate Characters](https://www.internhack.in/learn/dsa/problem/lexicographically-smallest-string-after-deleting-duplicate-characters) (Hard)
72. [Longest Valid Parentheses](https://www.internhack.in/learn/dsa/problem/longest-valid-parentheses) (Hard)
73. [Max Chunks To Make Sorted II](https://www.internhack.in/learn/dsa/problem/max-chunks-to-make-sorted-ii) (Hard)
74. [Max Stack](https://www.internhack.in/learn/dsa/problem/max-stack) (Hard)
75. [Maximal Rectangle](https://www.internhack.in/learn/dsa/problem/maximal-rectangle) (Hard)
76. [Maximum Frequency Score of a Subarray](https://www.internhack.in/learn/dsa/problem/maximum-frequency-score-of-a-subarray) (Hard)
77. [Maximum Frequency Stack](https://www.internhack.in/learn/dsa/problem/maximum-frequency-stack) (Hard)
78. [Maximum Number of Books You Can Take](https://www.internhack.in/learn/dsa/problem/maximum-number-of-books-you-can-take) (Hard)
79. [Maximum Score of a Good Subarray](https://www.internhack.in/learn/dsa/problem/maximum-score-of-a-good-subarray) (Hard)
80. [Minimum Cost to Change the Final Value of Expression](https://www.internhack.in/learn/dsa/problem/minimum-cost-to-change-the-final-value-of-expression) (Hard)
81. [Minimum Number of Increments on Subarrays to Form a Target Array](https://www.internhack.in/learn/dsa/problem/minimum-number-of-increments-on-subarrays-to-form-a-target-array) (Hard)
82. [Minimum Number of Visited Cells in a Grid](https://www.internhack.in/learn/dsa/problem/minimum-number-of-visited-cells-in-a-grid) (Hard)
83. [Minimum Operations to Make Array Equal to Target](https://www.internhack.in/learn/dsa/problem/minimum-operations-to-make-array-equal-to-target) (Hard)
84. [Minimum Time to Complete All Tasks](https://www.internhack.in/learn/dsa/problem/minimum-time-to-complete-all-tasks) (Hard)
85. [Number of Atoms](https://www.internhack.in/learn/dsa/problem/number-of-atoms) (Hard)
86. [Number of Valid Subarrays](https://www.internhack.in/learn/dsa/problem/number-of-valid-subarrays) (Hard)
87. [Number of Visible People in a Queue](https://www.internhack.in/learn/dsa/problem/number-of-visible-people-in-a-queue) (Hard)
88. [Odd Even Jump](https://www.internhack.in/learn/dsa/problem/odd-even-jump) (Hard)
89. [Parse Lisp Expression](https://www.internhack.in/learn/dsa/problem/parse-lisp-expression) (Hard)
90. [Parsing A Boolean Expression](https://www.internhack.in/learn/dsa/problem/parsing-a-boolean-expression) (Hard)
91. [Replace Non-Coprime Numbers in Array](https://www.internhack.in/learn/dsa/problem/replace-non-coprime-numbers-in-array) (Hard)
92. [Robot Collisions](https://www.internhack.in/learn/dsa/problem/robot-collisions) (Hard)
93. [Smallest K-Length Subsequence With Occurrences of a Letter](https://www.internhack.in/learn/dsa/problem/smallest-k-length-subsequence-with-occurrences-of-a-letter) (Hard)
94. [Stamping The Sequence](https://www.internhack.in/learn/dsa/problem/stamping-the-sequence) (Hard)
95. [Subarray With Elements Greater Than Varying Threshold](https://www.internhack.in/learn/dsa/problem/subarray-with-elements-greater-than-varying-threshold) (Hard)
96. [Sum of Total Strength of Wizards](https://www.internhack.in/learn/dsa/problem/sum-of-total-strength-of-wizards) (Hard)
97. [Tag Validator](https://www.internhack.in/learn/dsa/problem/tag-validator) (Hard)
98. [The Score of Students Solving Math Expression](https://www.internhack.in/learn/dsa/problem/the-score-of-students-solving-math-expression) (Hard)
99. [Trapping Rain Water](https://www.internhack.in/learn/dsa/problem/trapping-rain-water) (Hard)
100. [Zuma Game](https://www.internhack.in/learn/dsa/problem/zuma-game) (Hard)

## Companies that ask stack problems

- [Amazon](https://www.internhack.in/learn/dsa/companies/amazon): 81 of these problems
- [Google](https://www.internhack.in/learn/dsa/companies/google): 78 of these problems
- [Meta](https://www.internhack.in/learn/dsa/companies/meta): 53 of these problems
- [Microsoft](https://www.internhack.in/learn/dsa/companies/microsoft): 53 of these problems
- [Bloomberg](https://www.internhack.in/learn/dsa/companies/bloomberg): 48 of these problems
- [Oracle](https://www.internhack.in/learn/dsa/companies/oracle): 23 of these problems
- [Tiktok](https://www.internhack.in/learn/dsa/companies/tiktok): 23 of these problems
- [Apple](https://www.internhack.in/learn/dsa/companies/apple): 19 of these problems
- [Goldman Sachs](https://www.internhack.in/learn/dsa/companies/goldman-sachs): 18 of these problems
- [Salesforce](https://www.internhack.in/learn/dsa/companies/salesforce): 15 of these problems
- [Flipkart](https://www.internhack.in/learn/dsa/companies/flipkart): 15 of these problems
- [Uber](https://www.internhack.in/learn/dsa/companies/uber): 14 of these problems

## Before your interview

Most resumes are filtered by software before a recruiter reads them. [Check your resume ATS score free](https://www.internhack.in/ats-score/try), no signup needed.

## Other DSA topics

- [Array](https://www.internhack.in/learn/dsa/array) (1869)
- [String](https://www.internhack.in/learn/dsa/string) (775)
- [Hash Table](https://www.internhack.in/learn/dsa/hash-table) (708)
- [Math](https://www.internhack.in/learn/dsa/math) (564)
- [Dynamic Programming](https://www.internhack.in/learn/dsa/dynamic-programming) (557)
- [Sorting](https://www.internhack.in/learn/dsa/sorting) (464)
- [Greedy](https://www.internhack.in/learn/dsa/greedy) (407)
- [Depth-First Search](https://www.internhack.in/learn/dsa/depth-first-search) (314)
- [Binary Search](https://www.internhack.in/learn/dsa/binary-search) (298)
- [Matrix](https://www.internhack.in/learn/dsa/matrix) (246)
- [Breadth-First Search](https://www.internhack.in/learn/dsa/breadth-first-search) (245)
- [Bit Manipulation](https://www.internhack.in/learn/dsa/bit-manipulation) (238)
- [Tree](https://www.internhack.in/learn/dsa/tree) (235)
- [Two Pointers](https://www.internhack.in/learn/dsa/two-pointers) (217)
- [Prefix Sum](https://www.internhack.in/learn/dsa/prefix-sum) (204)
- [Database](https://www.internhack.in/learn/dsa/database) (197)
- [Heap (Priority Queue)](https://www.internhack.in/learn/dsa/heap-priority-queue) (196)
- [Simulation](https://www.internhack.in/learn/dsa/simulation) (177)
- [Counting](https://www.internhack.in/learn/dsa/counting) (174)
- [Binary Tree](https://www.internhack.in/learn/dsa/binary-tree) (169)

## Related

- [Home](https://www.internhack.in/)
- [Learn](https://www.internhack.in/learn)
- [DSA](https://www.internhack.in/learn/dsa)
