Stack – Interview Questions and Practice Problems

A stack is a linear Last-In-Last-Out (LIFO) data structure which means that the last element added to the stack will be the first one to be removed. Therefore, once a new element is added to the stack, all elements that were added after it has to be removed before the new element can be removed.

 
In this post, we have listed out commonly asked interview questions that use stack data structure:

  1. Stack implementation using an array – C, C++, Java, PythonBeginner
  2. Stack Implementation using a Linked ListBeginner
  3. Implement a stack using the queue data structureMedium
  4. Implement a queue using the stack data structureMedium
  5. Design a stack that returns the minimum element in constant timeHard
  6. Design a stack that returns a minimum element without using an auxiliary stackHard
  7. Implement two stacks in a single arrayEasy
  8. Recursive solution to sort a stackHard
  9. Reverse a stack using recursionHard
  10. Reverse a string using a stack data structureEasy
  11. Check if an expression is balanced or notEasy
  12. Find duplicate parenthesis in an expressionMedium
  13. Evaluate a postfix expressionEasy
  14. Decode a given sequence to construct a minimum number without repeated digitsHard
  15. Merging Overlapping IntervalsMedium
  16. Convert an infix expression into a postfix expressionMedium
  17. Find the next greater element for every element in a circular arrayHard
  18. Find the next greater element for every array elementMedium
  19. Find the previous smaller element for each array elementMedium
  20. Reverse an array in C++Easy
  21. Longest Increasing Subsequence ProblemHard
  22. Find all elements in an array that are greater than all elements to their rightEasy
  23. Iterative Implementation of QuicksortMedium
  24. Find all binary strings that can be formed from a wildcard patternMedium
  25. Find the length of the longest balanced parenthesis in a stringHard
  26. Reverse text without reversing individual wordsMedium
  27. Reverse a string without using recursionEasy
  28. Inorder Tree TraversalMedium
  29. Preorder Tree TraversalMedium
  30. Postorder Tree TraversalMedium
  31. Check if two binary trees are identical or notEasy
  32. Find ancestors of a given node in a binary treeMedium
  33. Iteratively print the leaf to root path for every leaf node in a binary treeMedium
  34. Find preorder traversal of a binary tree from its inorder and postorder sequenceHard
  35. Construction of an expression treeEasy
  36. Print complete Binary Search Tree (BST) in increasing orderEasy
  37. Depth First Search (DFS)Medium
  38. Check whether the leaf traversal of given binary trees is the same or notHard
  39. Reverse level order traversal of a binary treeEasy
  40. Invert Binary TreeEasy
  41. Invert alternate levels of a perfect binary treeHard
  42. Depth-First Search (DFS) vs Breadth-First Search (BFS)Beginner

Rate this post

Average rating 4.79/5. Vote count: 76

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Tell us how we can improve this post?

Thanks for reading.

To share your code in the comments, please use our online compiler that supports C, C++, Java, Python, JavaScript, C#, PHP, and many more popular programming languages.

Like us? Refer us to your friends and support our growth. Happy coding :)


guest
0 Comments
Inline Feedbacks
View all comments
Do NOT follow this link or you will be banned from the site!