Stack Interview Questions and Practice Problems

A stack is an abstract data type that serves as a collection of elements, with two principal operations: push, which adds an element to the collection, and pop, which removes the most recently added element that was not yet removed. The order in which elements come off a stack gives rise to its alternative name, LIFO (for last in, first out). Additionally, a peek operation may give access to the top without modifying the stack.

Considered as a linear data structure, the push and pop operations occur only at one end of the structure, referred to as the top of the stack. This makes it possible to implement a stack as a singly linked list and a pointer to the top element.

A stack may be implemented to have a bounded capacity. If the stack is full and does not contain enough space to accept an entity to be pushed, the stack is then considered to be in an overflow state. The pop operation removes an item from the top of the stack.

In this post, we have list out commonly asked interview questions that uses stack data structure-


  1. Stack Implementation
  2. Stack Implementation using Linked List
  3. Check if given expression is balanced expression or not
  4. Find duplicate parenthesis in an expression
  5. Evaluate given postfix expression
  6. Decode the given sequence to construct minimum number without repeated digits
  7. Design a stack which returns minimum element in constant time
  8. Design a stack which returns minimum element without using auxiliary stack
  9. Reverse a string without using recursion
  10. Reverse a string using stack data structure
  11. Inorder Tree Traversal | Iterative & Recursive
  12. Preorder Tree Traversal | Iterative & Recursive
  13. Postorder Tree Traversal | Iterative & Recursive
  14. Find ancestors of given node in a Binary Tree
  15. Check if two given binary trees are identical or not | Iterative & Recursive
  16. Reverse Level Order Traversal of Binary Tree
  17. Reverse given text without reversing the individual words
  18. Find all binary strings that can be formed from given wildcard pattern
  19. Iterative Implementation of Quicksort
  20. Depth First Search (DFS) | Iterative & Recursive Implementation
  21. Invert given Binary Tree | Recursive and Iterative solution
  22. Print leaf to root path for every leaf node in a binary tree
  23. Longest Increasing Subsequence


Thank you for being with us. 🙂


Leave a Reply

Notify of