Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Stack

Stack data structure problems and applications.

Key Concepts Covered

  • LIFO (Last In First Out) principle
  • Stack implementation (array and linked list)
  • Monotonic stack technique
  • Expression evaluation
  • Parentheses matching
  • Next/Previous greater/smaller element
  • Histogram problems

Problems in this Directory

Basic Stack Operations

  • stacks - Stack implementation
  • queue - Queue implementation
  • set - Set operations

Parentheses Matching

Monotonic Stack

Histogram Problems

Character Problems

Stack Unwinding

Tips

  • Think of stack for "most recent" problems
  • Use monotonic stack for next/previous element problems
  • Stack is great for parsing and validation
  • Can often optimize O(n²) nested loops to O(n)