Turning Learners Into Developers
Codekilla
CODEKILLA
Medium
JAVA-003java

Valid Parentheses

Problem

Given a string of brackets `()[]{}`, return `true` if every opener has a matching closer in the correct order.

Input
One line: the bracket string.
Output
`true` or `false`.
Constraints
0 ≤ |s| ≤ 10^4
Sample input
()[]{}
Sample output
true
Explanation
Every opener is closed in LIFO order.
stackstringsdesign@Google@Microsoft@Bloomberg
Visible test cases
in: ()[]{}
out: true
in: ([)]
out: false
in: {[]}
out: true
Your solution — run it, use AI if stuck
java