Learnixo
Challenges

Valid Parentheses

beginner 50 XP

Problem

Given a string containing `(`, `)`, `{`, `}`, `[`, `]`, determine if the input string is valid. A string is valid if brackets are closed in the correct order.

Test Cases

Simple parens
Input: "()"
Expected: True
All types
Input: "()[]{}"
Expected: True
Mismatched
Input: "(]"
Expected: False
Wrong order
Input: "([)]"
Expected: False

Hints

AI Assistance