#2 most askedVery commonEasyStack
Valid Parentheses
New to Stack? Learn it from scratch firstTwo Pointers & Stacks โ
๐ข Asked in real interviews
No reports yet. Were you asked this? Be the first to say where.Given a string of brackets ()[]{}, return True if every opening bracket is closed by the same type, in the right order.
"([]{})" โ True, "(]" โ False, "((" โ False.
๐งช Practice
Write your solution, then press Run tests. Explain your approach out loud as you go.
def is_valid(s):
pass
Output appears here. Press Run or Ctrl/โ + Enter.
Try it first. Struggling for a few minutes is how it sticks.