Stack Interview Questions: From Basics to Advanced Problem-Solving
Nozibul Islam
Posted on October 21, 2024
Comprehensive Stack Interview Questions: From Basics to Advanced Problem-Solving.
1. Stack Basics
- Implementing a Stack Using Arrays
- Implementing a Stack Using Linked Lists
- Implementing a Stack Using Two Queues
- Implementing a Stack Using a Single Queue
- Stack Operations (Push, Pop, Peek)
- Implementing a Min Stack (Get Minimum in O(1) Time)
- Implementing a Max Stack (Get Maximum in O(1) Time)
- Implementing a Stack Using Two Stacks
- Implementing a Stack Using Recursion
- Stack Implementation Using Dynamic Arrays
2. Infix, Prefix, and Postfix Expressions
- Converting Infix to Postfix
- Converting Infix to Prefix
- Converting Postfix to Infix
- Evaluating a Postfix Expression
- Evaluating a Prefix Expression
- Validating an Infix Expression
- Parenthesis Matching (Balanced Parentheses)
- Implementing Shunting Yard Algorithm for Expression Parsing
- Converting Infix to Postfix with Associativity and Precedence Handling
3. Advanced Stack Operations
- Design a Stack that Supports GetMin, GetMax, and GetMedian
- Implementing a Two-Stack Queue
- Design a Stack with Increment Operation
- Implementing a Stack Using Deque
- Implementing Special Stack Operations (Double Push, Double Pop)
- Building a Stack from Scratch Without Using Built-In Data Structures
- Implement a Stack with Dynamic Resizing
- Implement a Stack That Supports Middle Element Access
- Implement Stack Sorting Using Recursion
- Implement a Custom Stack with Customized Push/Pop Rules
4. Stack-Based Problem-Solving
- Next Greater Element to the Right
- Next Greater Element to the Left
- Next Smaller Element to the Right
- Next Smaller Element to the Left
- Stock Span Problem
- Trapping Rain water Problem
- Simplify Directory Path (Unix Style Path Simplification)
- Evaluate Reverse Polish Notation
- Validating Stack Sequences
5. Stack and Recursion
- Reverse a Stack Using Recursion
- Sort a Stack Using Recursion
- Insert an Element at the Bottom of a Stack Using Recursion
- Finding Maximum Depth of Nested Parentheses
- Decode a String with Nested Patterns (e.g., "3[a2[c]]" → "accaccacc")
- Checking Redundant Parentheses in an Expression
- Flattening Nested Lists (Nested List Weight Sum)
- Recursive Depth Calculation Using Stack
- Implement an Algorithm for the Nearest Smaller Values (Monotonic Stack )
6. Real-World Stack Applications
- Implement Browser Back/Forward Functionality Using Stacks
- Design Undo/Redo Operations Using Stacks
- Evaluate Mathematical Expressions Using Stacks
- Simulating Call Stack in Function Execution
- Implement a Text Editor with Parentheses Matching Feature
- Balancing Chemical Equations Using Stacks
7. Stack Variants and Custom Implementations
- Design a Thread-Safe Stack
- Implement a Circular Stack
- Implement a Persistent Stack (Immutable Data Structures)
- Create a Lock-Free Stack Using Atomic Operations
🔗 Connect with me on LinkedIn:
Let’s dive deeper into the world of software engineering together! I regularly share insights on JavaScript, Node.js, React, Next.js, data structures, algorithms, web development, and much more. Whether you're looking to enhance your skills or collaborate on exciting topics, I’d love to connect and grow with you.
Follow me: Nozibul Islam
💖 💪 🙅 🚩
Nozibul Islam
Posted on October 21, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.