Valid Parentheses

Easy · Stack & Monotonic Stack · about 10 minutes

Asked at Amazon, Meta, Google, Bloomberg, Microsoft, Palo Alto Networks, D. E. Shaw.

Given a string s containing only the characters ()[]{}, return true if every bracket is closed by the same type of bracket and the brackets close in the correct order.