← Problems

Valid Parentheses

EASY
Problem⌘ K
StackString

Valid Parentheses

Given a string containing only the characters '(', ')', '{', '}', '[' and ']', determine whether the input string is valid. Every opening bracket must close in the correct order.

Example

Input s = "{[]}"
Output true

Constraints

1 ≤ s.length ≤ 10⁴.s contains only bracket characters.

Think about

Try a first approach in the editor. Copilot reviews your actual code and asks one focused question when it finds a gap.

solution.c
Test resultsReady
$ Type your approach, then run the sample tests.
LIVE AI REVIEW · WAITING
Start typing or paste your attempt here.