Check for balanced brackets in a string
Given the string [()]{}{[()()]()}, write a function
that takes a string parameter containing brackets, determine if all brackets have a matching
counterpart.
If all brackets in the string form balanced pairs, return true. If not, return false.
What are a balanced brackets?
Brackets | Balanced? |
---|---|
([{}]) | |
[(]) | |
{(})[] | |
{()[]} |
Output