Codewars: Rust workspace for solving the 'Valid Braces' kata
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Jim Infield fd7c58f8d1 initial codewars submission 3 years ago
src initial codewars submission 3 years ago
.gitignore cargo init --bin 3 years ago
Cargo.lock cargo init --bin 3 years ago
Cargo.toml cargo init --bin 3 years ago
README.md add README 3 years ago

README.md

Valid Braces

Write a function that takes a string of braces, and determines if the order of the braces is valid. It should return true if the string is valid, and false if it's invalid.

This Kata is similar to the Valid Parentheses Kata, but introduces new characters: brackets [], and curly braces {}. Thanks to @arnedag for the idea!

All input strings will be nonempty, and will only consist of parentheses, brackets and curly braces: ()[]{}.

What is considered Valid?

A string of braces is considered valid if all braces are matched with the correct brace.

Examples

"(){}[]"   =>  True
"([{}])"   =>  True
"(}"       =>  False
"[(])"     =>  False
"[({})](]" =>  False