Stack

Level: Beginner

1. Stack Implementation: Implement a stack using an array.
2. Stack using Linked List: Implement a stack using a linked list.
3. Balanced Parentheses: Write a function to check if a string has balanced parentheses using a stack.
4. Reverse String: Use a stack to reverse a string.
5. Evaluate Postfix Expression: Implement a function to evaluate a postfix expression using a stack.
6. Sort Stack: Write a function to sort a stack.
7. Next Greater Element: Implement a function to find the next greater element for each element in an array using a stack.
8. Next Smaller Element: Write a function to find the next smaller element for each element in an array using a stack.
9. Stock Span Problem: Implement a function to solve the stock span problem using a stack.
10. Minimum Element in Stack: Design a stack that supports push, pop, and retrieving the minimum element in constant time.
11. Infix to Postfix Conversion: Write a function to convert an infix expression to a postfix expression using a stack.
12. Infix to Prefix Conversion: Implement a function to convert an infix expression to a prefix expression using a stack.
13. Postfix to Infix Conversion: Write a function to convert a postfix expression to an infix expression using a stack.
14. Prefix to Infix Conversion: Implement a function to convert a prefix expression to an infix expression using a stack.
15. Duplicate Parentheses: Write a function to check for duplicate parentheses in an expression using a stack.
16. Stack with Get Middle Operation: Design a stack with a function to get the middle element of the stack.
17. Valid Parentheses: Write a function to check if a string contains valid parentheses using a stack.
18. Celebrity Problem: Implement the celebrity problem using a stack.
19. Check for Redundant Brackets: Write a function to check for redundant brackets in an expression using a stack.
20. Decode String: Implement a function to decode a given encoded string using a stack.
21. Histogram Area: Write a function to find the largest rectangular area in a histogram using a stack.
22. Implement Queue using Stacks: Implement a queue using two stacks.
23. Check Palindrome: Use a stack to check if a given string is a palindrome.
24. Reverse Stack: Write a function to reverse a stack.
25. Sort Stack Recursively: Implement a function to sort a stack recursively.
26. Merge Intervals: Write a function to merge overlapping intervals using a stack.
27. Check Stack Permutations: Implement a function to check if two stacks' sequences are permutations of each other.
28. Basic Calculator: Write a function to implement a basic calculator that can evaluate simple expressions using a stack.
29. Largest Rectangle in Histogram: Implement a function to find the largest rectangle in a histogram using a stack.
30. Balanced Brackets: Write a function to check if a string has balanced brackets using a stack.

Intermediate Level: View

Advanced Level: View