← problems
#20

Valid Parentheses

EasyStack

Given a string s containing just the characters (), [] and {}, determine if the input string is valid.

A string is valid if open brackets are closed by the same type of bracket, and in the correct order.

Example

"()[]{}"  => true
"(]"      => false
"([)]"    => false
Implement
function IsValid(s: string) -> bool

Found a bug? Or annoyed about something in the language? Tell us.

loading editor…