Patterns
S · Pattern 20
Stack
LIFO (Last In First Out) data structure. Perfect for parsing strings, evaluating expressions, or matching pairs like parentheses.
- Time
- O(n)
- Space
- O(n)
Spot it when
- Matching pairs like nested parentheses
- Evaluating postfix/RPN expressions
- Tracking state that needs to be reversed or rewound
Problems
Easy to hard · 0/3 solved