LeetCode 20
Valid Parentheses
Concepts:
Stack
Description: Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
Optimal Approach
Iterate through the string, pushing opening brackets to a stack. When a closing bracket is encountered, pop the stack and check if the brackets match.
Time: O(n)
Space: O(n)